aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2012-05-29 18:07:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-29 19:22:32 -0400
commit4796dd200db943e36f876e7029552212e5bbdf33 (patch)
treea594c2b1ce1f4dbc96b25a516e49655917a9fa30 /include
parent05a6c8a9226599f921bd0b6e439dbc04df96a6fc (diff)
vsprintf: fix %ps on non symbols when using kallsyms
Using %ps in a printk format will sometimes fail silently and print the empty string if the address passed in does not match a symbol that kallsyms knows about. But using %pS will fall back to printing the full address if kallsyms can't find the symbol. Make %ps act the same as %pS by falling back to printing the address. While we're here also make %ps print the module that a symbol comes from so that it matches what %pS already does. Take this simple function for example (in a module): static void test_printk(void) { int test; pr_info("with pS: %pS\n", &test); pr_info("with ps: %ps\n", &test); } Before this patch: with pS: 0xdff7df44 with ps: After this patch: with pS: 0xdff7df44 with ps: 0xdff7df44 Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/kallsyms.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h
index 387571959dd9..6883e197acb9 100644
--- a/include/linux/kallsyms.h
+++ b/include/linux/kallsyms.h
@@ -36,6 +36,7 @@ const char *kallsyms_lookup(unsigned long addr,
36 36
37/* Look up a kernel symbol and return it in a text buffer. */ 37/* Look up a kernel symbol and return it in a text buffer. */
38extern int sprint_symbol(char *buffer, unsigned long address); 38extern int sprint_symbol(char *buffer, unsigned long address);
39extern int sprint_symbol_no_offset(char *buffer, unsigned long address);
39extern int sprint_backtrace(char *buffer, unsigned long address); 40extern int sprint_backtrace(char *buffer, unsigned long address);
40 41
41/* Look up a kernel symbol and print it to the kernel messages. */ 42/* Look up a kernel symbol and print it to the kernel messages. */
@@ -80,6 +81,12 @@ static inline int sprint_symbol(char *buffer, unsigned long addr)
80 return 0; 81 return 0;
81} 82}
82 83
84static inline int sprint_symbol_no_offset(char *buffer, unsigned long addr)
85{
86 *buffer = '\0';
87 return 0;
88}
89
83static inline int sprint_backtrace(char *buffer, unsigned long addr) 90static inline int sprint_backtrace(char *buffer, unsigned long addr)
84{ 91{
85 *buffer = '\0'; 92 *buffer = '\0';