Re: [PATCH v4 4/9] vsprintf: Consolidate handling of unknown pointer specifiers

From: Sergey Senozhatsky
Date: Fri Apr 06 2018 - 19:52:23 EST


On (04/05/18 16:55), Joe Perches wrote:
> On Thu, 2018-04-05 at 16:45 -0700, Joe Perches wrote:
> > On Thu, 2018-04-05 at 16:25 +0200, Rasmus Villemoes wrote:
> > > Even just git grep -1 -E '%p"$' finds %pt and %po
> > > which should get fixed before somebody claims those extensions.
> >
> > Neither %pt nor %po is used in a vsprintf
> > in the kernel.
>
> Nope, you are right, both are defectively used in the
> kernel via string concatenation.
>
> Also there's a missing space in a concatenation adjacent.

Can we tweak checkpatch to catch such things?


Hm... *Probably* also wouldn't hurt if checkpatch can require at least
one character after pointer format specifiers:

printk("string %p" vs printk("string %p "
" Object\n", ptr); "Object\n", ptr);

Especially if we can have a "potential" %px, like here

dev_vdbg(&md->input->dev,
"%s: *axis=%02X(%d) size=%d max=%08X xy_data=%p"
" xy_data[%d]=%02X(%d) bofs=%d\n",

or here

dev_vdbg(&md->input->dev,
"%s: *axis=%02X(%d) size=%d max=%08X xy_data=%p"
" xy_data[%d]=%02X(%d)\n",

Opinions?

-ss