diff mbox

[U-Boot,2/4] Fix itest mask overflow

Message ID 1400901095-29391-3-git-send-email-sjg@chromium.org
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Simon Glass May 24, 2014, 3:11 a.m. UTC
The mask value used in itest overflows and therefore it can return an
incorrect result for something like 'itest 0 == 1'. Fix it.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 common/cmd_itest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/common/cmd_itest.c b/common/cmd_itest.c
index ae2527b..76af62b 100644
--- a/common/cmd_itest.c
+++ b/common/cmd_itest.c
@@ -63,7 +63,7 @@  static long evalexp(char *s, int w)
 		l = simple_strtoul(s, NULL, 16);
 	}
 
-	return (l & ((1 << (w * 8)) - 1));
+	return l & ((1UL << (w * 8)) - 1);
 }
 
 static char * evalstr(char *s)