Skip to content

Commit

Permalink
vsprintf: Do not preprocess non-dereferenced pointers for bprintf (%p…
Browse files Browse the repository at this point in the history
…x and %pK)

Commit 841a915 ("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: [email protected]
Fixes: 841a915 ("printf: Do not have bprintf dereference pointers")
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
  • Loading branch information
rostedt committed Apr 6, 2018
1 parent b28d7b2 commit 1e6338c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/vsprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2591,6 +2591,8 @@ int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args)
case 's':
case 'F':
case 'f':
case 'x':
case 'K':
save_arg(void *);
break;
default:
Expand Down Expand Up @@ -2765,6 +2767,8 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
case 's':
case 'F':
case 'f':
case 'x':
case 'K':
process = true;
break;
default:
Expand Down

0 comments on commit 1e6338c

Please sign in to comment.