Re: [PATCH 1/2] vsprintf: distinguish between (null), (err) and (invalid) pointer derefs

From: Alexey Dobriyan
Date: Tue Mar 06 2018 - 13:22:28 EST


> +#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.