aboutsummaryrefslogtreecommitdiffstats
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <rostedt@goodmis.org>2018-04-03 14:38:53 -0400
committerSteven Rostedt (VMware) <rostedt@goodmis.org>2018-04-06 08:56:51 -0400
commit1e6338cfb50e244c445ad7d891b35385bd0ee757 (patch)
treea705089ef2d001966b5eb65f11ca39b8bce41fc3 /lib/vsprintf.c
parentb28d7b2dc27f0eef1ae608b49d6860f2463910f1 (diff)
vsprintf: Do not preprocess non-dereferenced pointers for bprintf (%px and %pK)
Commit 841a915d20c7b2 ("printf: Do not have bprintf dereference pointers") would preprocess various pointers that are dereferenced in the bprintf() because the recording and printing are done at two different times. Some pointers stayed dereferenced in the ring buffer because user space could handle them (namely "%pS" and friends). Pointers that are not dereferenced should not be processed immediately but instead just saved directly. Cc: stable@vger.kernel.org Fixes: 841a915d20c7b2 ("printf: Do not have bprintf dereference pointers") Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index d7a708f82559..89f8a4a4b770 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -2591,6 +2591,8 @@ int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args)
2591 case 's': 2591 case 's':
2592 case 'F': 2592 case 'F':
2593 case 'f': 2593 case 'f':
2594 case 'x':
2595 case 'K':
2594 save_arg(void *); 2596 save_arg(void *);
2595 break; 2597 break;
2596 default: 2598 default:
@@ -2765,6 +2767,8 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
2765 case 's': 2767 case 's':
2766 case 'F': 2768 case 'F':
2767 case 'f': 2769 case 'f':
2770 case 'x':
2771 case 'K':
2768 process = true; 2772 process = true;
2769 break; 2773 break;
2770 default: 2774 default: