linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vsprintf: avoid misleading "(null)" for %px
@ 2018-02-04 17:45 Adam Borowski
  2018-02-05  9:44 ` Petr Mladek
  0 siblings, 1 reply; 20+ messages in thread
From: Adam Borowski @ 2018-02-04 17:45 UTC (permalink / raw)
  To: Petr Mladek, Sergey Senozhatsky, Steven Rostedt, linux-kernel
  Cc: Adam Borowski

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.

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
---
 lib/vsprintf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 77ee6ced11b1..d7a708f82559 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1849,7 +1849,7 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr,
 {
 	const int default_width = 2 * sizeof(void *);
 
-	if (!ptr && *fmt != 'K') {
+	if (!ptr && *fmt != 'K' && *fmt != 'x') {
 		/*
 		 * Print (null) with the same width as a pointer so it makes
 		 * tabular output look nice.
-- 
2.15.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2018-02-14 14:35 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-04 17:45 [PATCH] vsprintf: avoid misleading "(null)" for %px Adam Borowski
2018-02-05  9:44 ` Petr Mladek
2018-02-05 10:03   ` Tobin C. Harding
2018-02-05 15:22     ` Adam Borowski
2018-02-05 16:49       ` Steven Rostedt
2018-02-05 17:36         ` Randy Dunlap
2018-02-05 20:19           ` Tobin C. Harding
2018-02-05 18:57   ` Kees Cook
2018-02-05 20:15     ` Tobin C. Harding
2018-02-05 20:32       ` Kees Cook
2018-02-05 20:58         ` Adam Borowski
2018-02-05 22:22           ` Tobin C. Harding
2018-02-06 18:43             ` Andy Shevchenko
2018-02-07 15:03           ` Petr Mladek
2018-02-07 15:11             ` Geert Uytterhoeven
2018-02-07 15:41               ` Petr Mladek
2018-02-07 15:48                 ` Geert Uytterhoeven
2018-02-08 15:29                 ` Andy Shevchenko
2018-02-09 12:03                   ` Petr Mladek
2018-02-14 14:35                     ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).