[Test] [PATCH] cmd: Fix bug in itest command with evalxp() for numerics
Alan Douglas
alanjhd at gmail.com
Fri Mar 4 15:37:53 CET 2016
Subject: [PATCH] cmd: Fix bug in itest command with evalxp() for numerics
Use 1ULL rather than 1UL for value to be left-shifted 32, to
avoid undefined behaviour.
Bug results in itest evaluating numerics as 0 on some processors, e.g.
U-Boot> itest 43 == 42 && echo "43 == 42"
43 == 42
Signed-off-by: Alan Douglas <adouglas at cadence.com>
---
cmd/itest.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cmd/itest.c b/cmd/itest.c
index fb4d797..a585300 100644
--- a/cmd/itest.c
+++ b/cmd/itest.c
@@ -80,7 +80,7 @@ static long evalexp(char *s, int w)
l = simple_strtoul(s, NULL, 16);
}
- return l & ((1UL << (w * 8)) - 1);
+ return l & ((1ULL << (w * 8)) - 1);
}
static char * evalstr(char *s)
--
1.7.1
More information about the Test
mailing list