Stefan Reinauer (stefan.reinauer@coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2904
-gerrit
commit 5de4c5f9080725f2462969b68d4a3a31fad487e1 Author: Stefan Reinauer reinauer@chromium.org Date: Mon Mar 25 15:13:20 2013 -0700
libpayload: fix size_t handling
libcbfs was using printf for size_t typed variables. However, printf did not support printing those. This patch fixes the issue, removing the warning when compiling ram_media.c
libcbfs/ram_media.c:52:10: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat] libcbfs/ram_media.c:52:10: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int' [-Wformat]
Change-Id: Iaf6e723f9a5b0a61a39d3125036fee9853e37ba8 Signed-off-by: Stefan Reinauer reinauer@google.com --- payloads/libpayload/libc/printf.c | 3 +++ payloads/libpayload/libcbfs/ram_media.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/payloads/libpayload/libc/printf.c b/payloads/libpayload/libc/printf.c index ccb64fd..bc2c41c 100644 --- a/payloads/libpayload/libc/printf.c +++ b/payloads/libpayload/libc/printf.c @@ -552,6 +552,9 @@ static int printf_core(const char *fmt, struct printf_spec *ps, va_list ap) qualifier = PrintfQualifierByte; } break; + case 'z': /* size_t or ssize_t */ + qualifier = PrintfQualifierLong; + break; case 'l': /* long or long long */ qualifier = PrintfQualifierLong; if (fmt[i] == 'l') { diff --git a/payloads/libpayload/libcbfs/ram_media.c b/payloads/libpayload/libcbfs/ram_media.c index 1a0500e..859555c 100644 --- a/payloads/libpayload/libcbfs/ram_media.c +++ b/payloads/libpayload/libcbfs/ram_media.c @@ -48,7 +48,7 @@ static void *ram_map(struct cbfs_media *media, size_t offset, size_t count) { offset = m->size + offset; } if (offset + count > m->size) { - printf("ERROR: ram_map: request out of range (0x%x+0x%x)\n", + printf("ERROR: ram_map: request out of range (0x%zx+0x%zx)\n", offset, count); return NULL; }