Skip to content

Commit 3a129cc

Browse files
kilobytepmladek
authored andcommitted
vsprintf: avoid misleading "(null)" for %px
Like %pK already does, print "00000000" instead. This confused people -- the convention is that "(null)" means you tried to dereference a null pointer as opposed to printing the address. Link: http://lkml.kernel.org/r/[email protected] To: Sergey Senozhatsky <[email protected]> To: Steven Rostedt <[email protected]> To: [email protected] Cc: Andrew Morton <[email protected]> Cc: Joe Perches <[email protected]> Cc: Kees Cook <[email protected]> Cc: "Roberts, William C" <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: David Laight <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Signed-off-by: Adam Borowski <[email protected]> Signed-off-by: Petr Mladek <[email protected]>
1 parent ab486bc commit 3a129cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/vsprintf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
18491849
{
18501850
const int default_width = 2 * sizeof(void *);
18511851

1852-
if (!ptr && *fmt != 'K') {
1852+
if (!ptr && *fmt != 'K' && *fmt != 'x') {
18531853
/*
18541854
* Print (null) with the same width as a pointer so it makes
18551855
* tabular output look nice.

0 commit comments

Comments
 (0)