do_mem_mtest() rejects a range where end is before start, but not one
where they are equal. An equal start and end passes through to
mem_test_alt(), where num_words = (end - start) / sizeof(ulong)
comes out to 0, leaving the function to operate on a range it was
never meant to handle rather than on the empty one actually
requested.

Treat end == start as the same empty range it already prints a
message for.

Signed-off-by: Thomas Perrot <[email protected]>
---
 cmd/mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmd/mem.c b/cmd/mem.c
index 68eb6989b945..ee428a5bcf57 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -1096,7 +1096,7 @@ static int do_mem_mtest(struct cmd_tbl *cmdtp, int flag, 
int argc,
                if (strict_strtoul(argv[4], 16, &iteration_limit) < 0)
                        return CMD_RET_USAGE;
 
-       if (end < start) {
+       if (end <= start) {
                printf("Refusing to do empty test\n");
                return -1;
        }

---
base-commit: ece349ade2973e220f524ce59e59711cc919263f
change-id: 20261010-tprrt-mtest-empty-range-350663c1b9d9

Best regards,
-- 
Thomas Perrot <[email protected]>

Reply via email to