Skip to contentSkip to conversation

s390/jump_label: Use %*ph to print small buffers

PATCH Superseded Alexander Kuleshov 2 participants 3 messages Aug 26, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/jump_label: Use %*ph to print small buffers

printk() supports %*ph format specifier for printing a small buffers, let's use it intead of %02x %02x...

---
 arch/s390/kernel/jump_label.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/s390/kernel/jump_label.c +3 -3
index a902996..cdf7c9e 100644
@@ -44,11 +44,11 @@ static void jump_label_bug(struct jump_entry *entry, struct insn *expected,
 	unsigned char *ipn = (unsigned char *)new;
 
 	pr_emerg("Jump label code mismatch at %pS [%p]\n", ipc, ipc);
-	pr_emerg("Found:    %02x %02x %02x %02x %02x %02x\n",
+	pr_emerg("Found:    %6ph\n",
 		 ipc[0], ipc[1], ipc[2], ipc[3], ipc[4], ipc[5]);
-	pr_emerg("Expected: %02x %02x %02x %02x %02x %02x\n",
+	pr_emerg("Expected: %6ph\n",
 		 ipe[0], ipe[1], ipe[2], ipe[3], ipe[4], ipe[5]);
-	pr_emerg("New:      %02x %02x %02x %02x %02x %02x\n",
+	pr_emerg("New:      %6ph\n",
 		 ipn[0], ipn[1], ipn[2], ipn[3], ipn[4], ipn[5]);
 	panic("Corrupted kernel text");
 }
Signature · 1 line
2.5.0
#1 lore raw

Hi Alexander,

Quoted 2 lines · Alexander Kuleshov

printk() supports %*ph format specifier for printing a small buffers, let's use it intead of %02x %02x...

noble effort ...

arch/s390/kernel/jump_label.c static void jump_label_bug(struct jump_entry *entry, struct insn *expected, · line 54

Quoted 12 lines
arch/s390/kernel/jump_label.c +3 -3
 	pr_emerg("Jump label code mismatch at %pS [%p]\n", ipc, ipc);
-	pr_emerg("Found:    %02x %02x %02x %02x %02x %02x\n",
+	pr_emerg("Found:    %6ph\n",
 		 ipc[0], ipc[1], ipc[2], ipc[3], ipc[4], ipc[5]);
-	pr_emerg("Expected: %02x %02x %02x %02x %02x %02x\n",
+	pr_emerg("Expected: %6ph\n",
 		 ipe[0], ipe[1], ipe[2], ipe[3], ipe[4], ipe[5]);
-	pr_emerg("New:      %02x %02x %02x %02x %02x %02x\n",
+	pr_emerg("New:      %6ph\n",
 		 ipn[0], ipn[1], ipn[2], ipn[3], ipn[4], ipn[5]);
 	panic("Corrupted kernel text");
 }

... but you might want to check our code before submission (e.g. compile it!)

Cheers
Tillmann

#2 lore raw

Hello Tillmann, sorry for noise, will resend.

2015-08-27 1:03 GMT+06:00 Tillmann Heidsieck <[email protected]>:

Quoted 29 lines

Hi Alexander,

Quoted 3 lines · Alexander Kuleshov

printk() supports %*ph format specifier for printing a small buffers, let's use it intead of %02x %02x...

noble effort ...

arch/s390/kernel/jump_label.c static void jump_label_bug(struct jump_entry *entry, struct insn *expected, · line 54

Quoted 12 lines
        pr_emerg("Jump label code mismatch at %pS [%p]\n", ipc, ipc);
arch/s390/kernel/jump_label.c +3 -3
-       pr_emerg("Found:    %02x %02x %02x %02x %02x %02x\n",
+       pr_emerg("Found:    %6ph\n",
                 ipc[0], ipc[1], ipc[2], ipc[3], ipc[4], ipc[5]);
-       pr_emerg("Expected: %02x %02x %02x %02x %02x %02x\n",
+       pr_emerg("Expected: %6ph\n",
                 ipe[0], ipe[1], ipe[2], ipe[3], ipe[4], ipe[5]);
-       pr_emerg("New:      %02x %02x %02x %02x %02x %02x\n",
+       pr_emerg("New:      %6ph\n",
                 ipn[0], ipn[1], ipn[2], ipn[3], ipn[4], ipn[5]);
        panic("Corrupted kernel text");
 }

... but you might want to check our code before submission (e.g. compile it!)

Cheers
Tillmann