projects
/
platform
/
kernel
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cmd: itest: correct calculus for long format
[platform/kernel/u-boot.git]
/
cmd
/
itest.c
diff --git
a/cmd/itest.c
b/cmd/itest.c
index
60626c7
..
e1896d9
100644
(file)
--- a/
cmd/itest.c
+++ b/
cmd/itest.c
@@
-80,7
+80,8
@@
static long evalexp(char *s, int w)
l = simple_strtoul(s, NULL, 16);
}
l = simple_strtoul(s, NULL, 16);
}
- return l & ((1UL << (w * 8)) - 1);
+ /* avoid overflow on mask calculus */
+ return (w >= sizeof(long)) ? l : (l & ((1UL << (w * 8)) - 1));
}
static char * evalstr(char *s)
}
static char * evalstr(char *s)