This is an automated email from Gerrit.

Christopher Head (ch...@zaber.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/5492

-- gerrit

commit 287a73113a56ff95f848d72eac5ac930e5cced22
Author: Christopher Head <ch...@zaber.com>
Date:   Tue Mar 3 13:25:50 2020 -0800

    flash/nor: check fill pattern fits in word size
    
    Change-Id: Idad527a428ceed2b53f3da41fb0c64bf8e62614a
    Signed-off-by: Christopher Head <ch...@zaber.com>

diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c
index 3287dd9..3990b2a 100644
--- a/src/flash/nor/tcl.c
+++ b/src/flash/nor/tcl.c
@@ -512,6 +512,14 @@ COMMAND_HANDLER(handle_flash_fill_command)
                        return ERROR_COMMAND_SYNTAX_ERROR;
        }
 
+       uint64_t pattern_mask = 0;
+       for (i = 0; i != wordsize; ++i)
+               pattern_mask = (pattern_mask << 8) | 0xFF;
+       if ((pattern & pattern_mask) != pattern) {
+               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;
 

-- 


_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to