From: John Schmoller <jschmol...@xes-inc.com>

The incrememt/decrement test has an off-by-one error which results in an
extra 4 bytes being tested past the specified end address.  For
instance, when running "mtest 0x1000 0x2000", the bytes 0x2000-0x2003
would be tested which is counterintuitive and at odds with the end
address calculation of other U-Boot memory tests.

Example of original behavior:
=> md 0x2000 10
00002000: deadbeef deadbeef deadbeef deadbeef    ................
00002010: deadbeef deadbeef deadbeef deadbeef    ................
00002020: deadbeef deadbeef deadbeef deadbeef    ................
00002030: deadbeef deadbeef deadbeef deadbeef    ................
=> mtest 0x1000 0x2000 1 1
Testing 00001000 ... 00002000:
Tested 1 iteration(s) with 0 errors.
=> md 0x2000 10
00002000: 00000000 deadbeef deadbeef deadbeef    ................
00002010: deadbeef deadbeef deadbeef deadbeef    ................
00002020: deadbeef deadbeef deadbeef deadbeef    ................
00002030: deadbeef deadbeef deadbeef deadbeef    ................
=>

This change results in the memory at 0x2000 not being modified by mtest
in the example above.

Signed-off-by: John Schmoller <jschmol...@xes-inc.com>
Signed-off-by: Peter Tyser <pty...@xes-inc.com>
---
 common/cmd_mem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/common/cmd_mem.c b/common/cmd_mem.c
index 1839330..0bc3c70 100644
--- a/common/cmd_mem.c
+++ b/common/cmd_mem.c
@@ -862,7 +862,7 @@ int do_mem_mtest (cmd_tbl_t *cmdtp, int flag, int argc, 
char *argv[])
                 *
                 * Returns:     0 if the test succeeds, 1 if the test fails.
                 */
-               num_words = ((ulong)end - (ulong)start)/sizeof(vu_long) + 1;
+               num_words = ((ulong)end - (ulong)start)/sizeof(vu_long);
 
                /*
                 * Fill memory with a known pattern.
-- 
1.7.0.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to