sh: fix format string bug in stack tracer
authorMatt Fleming <[email protected]>
Thu, 3 Apr 2014 21:46:20 +0000 (14:46 -0700)
committerLinus Torvalds <[email protected]>
Thu, 3 Apr 2014 23:20:49 +0000 (16:20 -0700)
Kees reported the following error:

   arch/sh/kernel/dumpstack.c: In function 'print_trace_address':
   arch/sh/kernel/dumpstack.c:118:2: error: format not a string literal and no format arguments [-Werror=format-security]

Use the "%s" format so that it's impossible to interpret 'data' as a
format string.

Signed-off-by: Matt Fleming <[email protected]>
Reported-by: Kees Cook <[email protected]>
Acked-by: Kees Cook <[email protected]>
Cc: Paul Mundt <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
arch/sh/kernel/dumpstack.c

index b959f55926043183a7abeff3c07d170717d7b923..8dfe645bcc4b85d65cc60bf7a50b9b0e7e55c29f 100644 (file)
@@ -115,7 +115,7 @@ static int print_trace_stack(void *data, char *name)
  */
 static void print_trace_address(void *data, unsigned long addr, int reliable)
 {
-       printk(data);
+       printk("%s", (char *)data);
        printk_address(addr, reliable);
 }