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

From: Joe Perches
Date: Fri Apr 06 2018 - 19:59:48 EST


On Sat, 2018-04-07 at 08:52 +0900, Sergey Senozhatsky wrote:
> 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?

Not really, no.

Adding regex logic for this is tricky at best
and probably not worth the effort because of
the various bits of patch contexts aren't
necessarily visible.

There are also concatenations like
"foo" DEFINE "bar"
where DEFINE may not be visible in the patch
context and checkpatch is and likely will
remain just a limited regex checker.