public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: kilobyte@angband.pl
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] vsprintf: distinguish between (null), (err) and (invalid) pointer derefs
Date: Tue, 6 Mar 2018 21:22:17 +0300	[thread overview]
Message-ID: <20180306182217.GA3798@avx2> (raw)

> +#define BAD_PTR_STRING(x) (!(x) ? "(null)" : IS_ERR(x) ? "(err)" : "(invalid)")

This is getting ridiculous.

Instead of simply printing a pointer as %08lx or %016llx, not only glibc
(null) stupidity is propagated but expanded and "improved".

I assure you reading 0000000000000000 is just as obvious as (null) and
reading fffffffffffffffa is just as good as -ENOMEM.

In fact printing with hex is more information. Maybe it is important
that buggy pointer is small value but it's value is lost.

Sure don't dereference a pointer for very small or very erry values
but print it without all the bell and whistles.

             reply	other threads:[~2018-03-06 18:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 18:22 Alexey Dobriyan [this message]
2018-03-06 18:42 ` [PATCH 1/2] vsprintf: distinguish between (null), (err) and (invalid) pointer derefs Adam Borowski
  -- strict thread matches above, loose matches on Subject: below --
2018-03-06  9:25 [PATCH] vsprintf: Make "null" pointer dereference more robust Petr Mladek
2018-03-06 18:11 ` [PATCH 1/2] vsprintf: distinguish between (null), (err) and (invalid) pointer derefs Adam Borowski
2018-03-07 13:17   ` Andy Shevchenko
2018-03-07 13:42     ` Adam Borowski
2018-03-07 13:29   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180306182217.GA3798@avx2 \
    --to=adobriyan@gmail.com \
    --cc=kilobyte@angband.pl \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox