[lkml]   [2019]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH v6 7/9] vsprintf: Consolidate handling of unknown pointer specifiers
On Fri 2019-02-08 19:25:18, Andy Shevchenko wrote:
> 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().

It is a matter of taste. plain_pointer_to_buffer() is not longer
really needed and makes the code more complicated from my POV.
On the other hand, the removal makes the patch more complicated
and harder to review.

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

The hashing is still tested by plain_hash() and plain_format().

The only remaining format using ptr_to_id() is %pK. But this one
would be tricky to test.

Anyway, I am going to keep plain_pointer_to_buffer() in v7
to make the patch simple. We could clean this later.

Best Regards,

 \ /
  Last update: 2019-02-12 14:36    [W:0.073 / U:0.608 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site