aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristopher Head <chead@zaber.com>2020-03-03 13:25:50 -0800
committerTomas Vanek <vanekt@fbl.cz>2020-03-17 16:40:53 +0000
commit140fe7f7145cb1159e9f530067e8acc62a3584b3 (patch)
tree7ee5d7407a412d39389e907c533350e26274d61e /src
parentaff486b6a05e1413520537d0d257e36e433754fd (diff)
downloadriscv-openocd-140fe7f7145cb1159e9f530067e8acc62a3584b3.zip
riscv-openocd-140fe7f7145cb1159e9f530067e8acc62a3584b3.tar.gz
riscv-openocd-140fe7f7145cb1159e9f530067e8acc62a3584b3.tar.bz2
flash/nor: check fill pattern fits in word size
Change-Id: Idad527a428ceed2b53f3da41fb0c64bf8e62614a Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5492 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/flash/nor/tcl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c
index 3287dd9..40105b4 100644
--- a/src/flash/nor/tcl.c
+++ b/src/flash/nor/tcl.c
@@ -512,6 +512,11 @@ COMMAND_HANDLER(handle_flash_fill_command)
return ERROR_COMMAND_SYNTAX_ERROR;
}
+ if ((wordsize < sizeof(pattern)) && (pattern >> (8 * wordsize) != 0)) {
+ command_print(CMD, "Fill pattern 0x%" PRIx64 " does not fit within %" PRIu32 "-byte word", pattern, wordsize);
+ return ERROR_FAIL;
+ }
+
if (count == 0)
return ERROR_OK;