diff options
author | Paul Menzel <paulepanter@users.sourceforge.net> | 2013-04-13 18:25:56 +0200 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2013-04-16 17:46:28 +0200 |
commit | 8d9ffd93b59781299bb2ed06d7f9ad30c7aac41b (patch) | |
tree | adda3eb424cef97f69abd3c57911640e73e18e0a /util/cbmem/cbmem.c | |
parent | 8c937c7e3cb9768c83e49a445f13e87a58d79768 (diff) | |
download | coreboot-8d9ffd93b59781299bb2ed06d7f9ad30c7aac41b.tar.xz |
cbmem: map_memory: Use length modifier `j` and cast for an `off_t` argument
cbmem currently fails to build due to `-Werror` and the following
warning.
$ make
cc -O2 -Wall -Werror -iquote ../../src/include -iquote ../../src/src/arch/x86 -c -o cbmem.o cbmem.c
cbmem.c: In function ‘map_memory’:
cbmem.c:87:2: error: format ‘%zx’ expects argument of type ‘size_t’, but argument 2 has type ‘off_t’ [-Werror=format]
[…]
Casting the argument of type `off_t` to `intmax_t` and using the
length modifier `j`
$ man 3 printf
[…]
j A following integer conversion corresponds to an intmax_t or uintmax_t argument.
[…]
instead of `z` as suggested in [1] and confirmed by stefanct and
segher in #coreboot on <irc.freenode.net>, gets rid of this warning
and should work an 32-bit and 64-bit systems, as an `off_t` fits
into `intmax_t`.
[1] http://www.pixelbeat.org/programming/gcc/int_types/
Change-Id: I1360abbc47aa1662e1edfbe337cf7911695c532f
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-on: http://review.coreboot.org/3083
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'util/cbmem/cbmem.c')
-rw-r--r-- | util/cbmem/cbmem.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c index ae5dbf6719..1ff9a08b2a 100644 --- a/util/cbmem/cbmem.c +++ b/util/cbmem/cbmem.c @@ -84,7 +84,7 @@ static void *map_memory(u64 physical) /* Mapped memory must be aligned to page size */ p = physical & ~(page - 1); - debug("Mapping 1MB of physical memory at 0x%zx.\n", p); + debug("Mapping 1MB of physical memory at 0x%jx.\n", (intmax_t)p); v = mmap(NULL, MAP_BYTES, PROT_READ, MAP_SHARED, fd, p); |