Re: [PATCH v6 7/9] vsprintf: Consolidate handling of unknown pointer specifiers

From: Andy Shevchenko
Date: Fri Feb 08 2019 - 12:25:25 EST


On Fri, Feb 08, 2019 at 04:23:08PM +0100, Petr Mladek wrote:
> There are few printk formats that make sense only with two or more
> specifiers. Also some specifiers make sense only when a kernel feature
> is enabled.
>
> The handling of unknown specifiers is inconsistent and not helpful.
> Using WARN() looks like an overkill for this type of error. pr_warn()
> is not good either. It would by handled via printk_safe buffer and
> it might be hard to match it with the problematic string.
>
> A reasonable compromise seems to be writing the unknown format specifier
> into the original string with a question mark, for example (%pC?).
> It should be self-explaining enough. Note that it is in brackets
> to follow the (null) style.
>

> Note that the changes in test_printf.c revert many changes made
> by the commit 4d42c44727a062e233 ("lib/vsprintf: Print time and
> date in human readable format via %pt\n"). The format %pt does
> not longer produce a hashed pointer.

It seems in further patch you partially restore back what was brought by that patch.
I would suggest not to touch at least changes for plain_pointer_to_buffer().

Also it would be nice to have a coverage for hashed pointers.

--
With Best Regards,
Andy Shevchenko