lkml.org 
[lkml]   [2018]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.15 001/122] vsprintf: avoid misleading "(null)" for %px
    Date
    4.15-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Adam Borowski <kilobyte@angband.pl>

    commit 3a129cc2151425e5aeb69aeb25fbc994ec738137 upstream.

    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/20180204174521.21383-1-kilobyte@angband.pl
    To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
    To: Steven Rostedt <rostedt@goodmis.org>
    To: linux-kernel@vger.kernel.org
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Joe Perches <joe@perches.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: "Roberts, William C" <william.c.roberts@intel.com>
    Cc: Linus Torvalds <torvalds@linux-foundation.org>
    Cc: David Laight <David.Laight@ACULAB.COM>
    Cc: Randy Dunlap <rdunlap@infradead.org>
    Cc: Geert Uytterhoeven <geert@linux-m68k.org>
    Signed-off-by: Adam Borowski <kilobyte@angband.pl>
    Signed-off-by: Petr Mladek <pmladek@suse.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    lib/vsprintf.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/lib/vsprintf.c
    +++ b/lib/vsprintf.c
    @@ -1849,7 +1849,7 @@ char *pointer(const char *fmt, char *buf
    {
    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.

    \
     
     \ /
      Last update: 2018-03-07 21:56    [W:7.740 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site