[PATCH 2/2] kexec: Fix compiler format warning

Geoff Levand geoff at infradead.org
Tue Feb 17 17:00:07 PST 2015


The sizeof operator returns a size_t type.  Change the printf format of sizeof
values from %d to %zu.  Fixes compiler warnings like these:

  kexec/fs2dt.c: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=]

Signed-off-by: Geoff Levand <geoff at infradead.org>
---
 kexec/fs2dt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kexec/fs2dt.c b/kexec/fs2dt.c
index fa7b550..d73e144 100644
--- a/kexec/fs2dt.c
+++ b/kexec/fs2dt.c
@@ -322,7 +322,7 @@ static void add_usable_mem_property(int fd, size_t len)
 
 	ranges = malloc(ranges_size * sizeof(*ranges));
 	if (!ranges)
-		die("unrecoverable error: can't alloc %d bytes for ranges.\n",
+		die("unrecoverable error: can't alloc %zu bytes for ranges.\n",
 		    ranges_size * sizeof(*ranges));
 
 	for (range = 0; range < usablemem_rgns.size; range++) {
@@ -345,7 +345,7 @@ static void add_usable_mem_property(int fd, size_t len)
 						 sizeof(*ranges));
 				if (!ranges)
 					die("unrecoverable error: can't realloc"
-					    "%d bytes for ranges.\n",
+					    "%zu bytes for ranges.\n",
 					    ranges_size*sizeof(*ranges));
 			}
 			ranges[rlen++] = cpu_to_be64(loc_base);
-- 
2.1.0




More information about the kexec mailing list