Skip to contentSkip to conversation

lib/vsprintf: Do not handle %pO[^F] as %px

PATCH In review Bart Van Assche 2 participants 2 messages Aug 6, 2018 – Aug 7, 2018

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

PATCH 1/1 lib/vsprintf: Do not handle %pO[^F] as %px

This patch avoids that gcc reports the following when building with W=1:

lib/vsprintf.c:1941:3: warning: this statement may fall through [-Wimplicit-fallthrough=]
switch (fmt[1]) {
^~~~~~

Fixes ce4fecf1fe15 ("vsprintf: Add %p extension "%pOF" for device tree")
Cc Pantelis Antoniou <[email protected]>
Cc Joe Perches <[email protected]>
Cc Rob Herring <[email protected]>
---
 lib/vsprintf.c | 1 +
 1 file changed, 1 insertion(+)
lib/vsprintf.c +1 -0
index a48aaa79d352..cda186230287 100644
@@ -1942,6 +1942,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
 		case 'F':
 			return device_node_string(buf, end, ptr, spec, fmt + 1);
 		}
+		break;
 	case 'x':
 		return pointer_string(buf, end, ptr, spec);
 	}
Signature · 1 line
2.18.0
maintainer
#1 lore raw
Quoted 7 lines · Bart Van Assche

This patch avoids that gcc reports the following when building with W=1:

lib/vsprintf.c:1941:3: warning: this statement may fall through [-Wimplicit-fallthrough=]

   switch (fmt[1]) {
   ^~~~~~
Fixes ce4fecf1fe15 ("vsprintf: Add %p extension "%pOF" for device tree")

To be precise, the above commit was fine because it was the last "case" in "switch". It has got broken by the commit 7b1924a1d930eb2 ("vsprintf: add printk specifier %px").

Other than that the patch fixes a real problem. I have updated the "Fixes" tag, added stable tag and pushed it into printk.git, for-4.19 branch.

Best Regards,
Petr