summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2014-12-29 19:53:51 +0100
committerPatrick Georgi <pgeorgi@google.com>2014-12-30 20:54:23 +0100
commit7086ea920d4181f1d4927e9f150a3976c7a8f3a7 (patch)
tree82c68f6669eaa37649773e98813792e2e89db896
parentbcf07c3f24e949b6a16f69ca5d21c5ecb1c9056e (diff)
libpayload: fix printf handling of unsigned long long
1 << 63 is undefined for 32bit numbers. Change-Id: I22f0e2486b133ea18cfbb8dd79fd4aed91ac0a4c Signed-off-by: Patrick Georgi <patrick@georgi-clan.de> Found-by: Coverity Scan Reviewed-on: http://review.coreboot.org/7972 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth <gaumless@gmail.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r--payloads/libpayload/libc/printf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/payloads/libpayload/libc/printf.c b/payloads/libpayload/libc/printf.c
index 8f76ccf286..cb623aa51a 100644
--- a/payloads/libpayload/libc/printf.c
+++ b/payloads/libpayload/libc/printf.c
@@ -647,7 +647,7 @@ static int printf_core(const char *fmt, struct printf_spec *ps, va_list ap)
}
if (flags & __PRINTF_FLAG_SIGNED) {
- if (number & (0x1 << (size * 8 - 1))) {
+ if (number & (0x1ULL << (size * 8 - 1))) {
flags |= __PRINTF_FLAG_NEGATIVE;
if (size == sizeof(uint64_t)) {