Skip to contentSkip to conversation

sparc: use %s for unaligned panic

PATCH RESEND In review Kees Cook 3 participants 3 messages Jun 30, 2014 – Jul 22, 2014 SPARC + UltraSPARC (sparc/sparc64)

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH RESEND 1/1 sparc: use %s for unaligned panic

Since unaligned_panic() takes a literal string, make sure it can never accidentally be used as a format string.

---
 arch/sparc/kernel/unaligned_32.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/kernel/unaligned_32.c +1 -1
index c5c61b3c6b56..32b61d1b6379 100644
@@ -166,7 +166,7 @@ unsigned long safe_compute_effective_address(struct pt_regs *regs,
 /* This is just to make gcc think panic does return... */
 static void unaligned_panic(char *str)
 {
-	panic(str);
+	panic("%s", str);
 }
 
 /* una_asm.S */
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security
#1 lore raw
Quoted 13 lines · Kees Cook

Since unaligned_panic() takes a literal string, make sure it can never accidentally be used as a format string.

---
 arch/sparc/kernel/unaligned_32.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/kernel/unaligned_32.c +0 -0
index c5c61b3c6b56..32b61d1b6379 100644

arch/sparc/kernel/unaligned_32.c unsigned long safe_compute_effective_address(struct pt_regs *regs, · line 172

Quoted 8 lines
arch/sparc/kernel/unaligned_32.c +1 -1
@@ -166,7 +166,7 @@ unsigned long safe_compute_effective_address(struct pt_regs *regs,
 /* This is just to make gcc think panic does return... */
 static void unaligned_panic(char *str)
 {
-	panic(str);
+	panic("%s", str);
 }
 
 /* una_asm.S */

The feedback last time was that this patch is silly. panic() has only two callsites within the same file.

Sam