lkml.org 
[lkml]   [2020]   [Feb]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] vsprintf: don't obfuscate NULL and error pointers
On Tue, Feb 18, 2020 at 8:39 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> On Tue, Feb 18, 2020 at 11:31 AM Adam Borowski <kilobyte@angband.pl> wrote:
> >
> > Either "0" or "NULL" (or "∅" if you allow cp437-subset Unicode ) wouldn't
> > cause such confusion.
>
> An all-uppercase "NULL" probably matches the error code printout
> syntax better too, and is more clearly a pointer.
>
> And with %pe you can't assume columnar output anyway (unless you
> explicitly ask for some width), so the length of the output cannot
> matter.
>
> So yeah, I agree. To extend on Ilya's example:
>
> ptr error-ptr NULL
> %p: 0000000001f8cc5b fffffffffffffff2 0000000000000000
> %pK, kptr = 0: 0000000001f8cc5b fffffffffffffff2 0000000000000000
> %px: ffff888048c04020 fffffffffffffff2 0000000000000000
> %pK, kptr = 1: ffff888048c04020 fffffffffffffff2 0000000000000000
> %pK, kptr = 2: 0000000000000000 0000000000000000 0000000000000000
> %p: 0000000001f8cc5b -EFAULT NULL

^^^
I assume you meant %pe here.

>
> would seem to be a sane output format. Hmm?

Looks sensible to me. Without this patch NULL is obfuscated for
both %p and %pe though. Do you want this patch amended or prefer
a follow-up for %pe "0000000000000000" -> "NULL" so that it can be
discussed separately?

Thanks,

Ilya

\
 
 \ /
  Last update: 2020-02-18 21:19    [W:0.165 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site