Skip to contentSkip to conversation

kexec-tools minor fixes

PATCH In review Geoff Levand 2 participants 4 messages Feb 18, 2015 – Feb 19, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover kexec-tools minor fixes

Hi Simon,

Here are a two minor fixes for compiler warnings. Please consider.

-Geoff

The following changes since commit 8e762175d295aad08a1cc62d6394e8285f225a40:

kexec-tools 2.0.9 (2015-02-09 14:47:41 +0900)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/geoff/kexec-tools.git for-merge

for you to fetch changes up to 9343d4063f95f2129bd2ecb5a2d96c169b799904:

kexec: Fix compiler format warning (2015-02-17 16:43:58 -0800)

----------------------------------------------------------------
Geoff Levand (2):
kexec: Fix compiler ambiguous else warning
kexec: Fix compiler format warning

 kexec/fs2dt.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
Signature · 7 lines
2.1.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#1 lore raw

PATCH 1/2 kexec: Fix compiler ambiguous else warning

Add braces to if statments in fs2dt.c. Fixes warnings like these when compiling with gcc 4.9.1:

kexec/fs2dt.c: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wparentheses]

---
 kexec/fs2dt.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
kexec/fs2dt.c +3 -2
index 3b4432d..fa7b550 100644
@@ -122,16 +122,17 @@ static void checkprop(char *name, unsigned *data, int len)
 	else if (!strcmp(name, "rtas-size") ||
 			!strcmp(name, "linux,tce-size"))
 		size = be32_to_cpu(*data);
-	else if (reuse_initrd && !strcmp(name, "linux,initrd-start"))
+	else if (reuse_initrd && !strcmp(name, "linux,initrd-start")) {
 		if (len == 8)
 			base = be64_to_cpu(*(unsigned long long *) data);
 		else
 			base = be32_to_cpu(*data);
-	else if (reuse_initrd && !strcmp(name, "linux,initrd-end"))
+	} else if (reuse_initrd && !strcmp(name, "linux,initrd-end")) {
 		if (len == 8)
 			end = be64_to_cpu(*(unsigned long long *) data);
 		else
 			end = be32_to_cpu(*data);
+	}
 
 	if (size && end)
 		die("unrecoverable error: size and end set at same time\n");
Signature · 8 lines
2.1.0



_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#2 lore raw

PATCH 2/2 kexec: Fix compiler format warning

In reply to Geoff Levand

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=]

---
 kexec/fs2dt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kexec/fs2dt.c +2 -2
index fa7b550..d73e144 100644
@@ -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);
Signature · 7 lines
2.1.0


_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
#3 lore raw
In reply to Geoff Levand
Quoted 8 lines · Geoff Levand

Hi Simon,

Here are a two minor fixes for compiler warnings. Please consider.

-Geoff

The following changes since commit 8e762175d295aad08a1cc62d6394e8285f225a40:

Quoted 7 lines

kexec-tools 2.0.9 (2015-02-09 14:47:41 +0900)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/geoff/kexec-tools.git for-merge

for you to fetch changes up to 9343d4063f95f2129bd2ecb5a2d96c169b799904:

Thanks, I have applied these patches manually.

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec