Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1578848

Re: [PATCH] checkpatch: add warning on %pk instead of %pK usage

From Joe Perches <joe@perches.com>
Newsgroups linux.kernel
Subject Re: [PATCH] checkpatch: add warning on %pk instead of %pK usage
Date 2017-02-11 00:00 +0100
Message-ID <t9sky-17u-7@gated-at.bofh.it> (permalink)
References <t9pd0-7Ix-23@gated-at.bofh.it> <t9pPH-8bb-7@gated-at.bofh.it> <t9rHQ-U6-11@gated-at.bofh.it> <t9rRv-Xp-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri, 2017-02-10 at 22:26 +0000, Roberts, William C wrote:
> <snip>
> 
> > > 
> > > On Fri, 2017-02-10 at 11:37 -0800, william.c.roberts@intel.com wrote:
> > > > From: William Roberts <william.c.roberts@intel.com>
> > > > 
> > > > Sample output:
> > > > WARNING: %pk is close to %pK, did you mean %pK?.
> > > > \#20: FILE: drivers/char/applicom.c:230:
> > > > +			printk(KERN_INFO "Could not allocate IRQ %d for PCI
> > > 
> > > Applicom
> > > > +device. %pk\n", dev->irq, pci_get_class);
> > > 
> > > There isn't a single instance of this in the kernel tree.
> > > 
> > > Maybe if this is really useful, then all the %p<foo> extensions should
> > > be enumerated and all unknown uses should have warnings.
> > 
> > I was thinking of doing that, but I figured I would start with the bare minimum
> > patch.
> > 
> > > 
> > > Something like:
> > > 
> > > ---
> > >  scripts/checkpatch.pl | 9 +++++++++
> > >  1 file changed, 9 insertions(+)
> > > 
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index
> > > ad5ea5c545b2..8a90b457e8b5 100755
> > > --- a/scripts/checkpatch.pl
> > > +++ b/scripts/checkpatch.pl
> > > @@ -5305,6 +5305,15 @@ sub process {
> > >  			}
> > >  		}
> > > 
> > > +# check for vsprintf extension %p<foo> misuses
> > > +		if ($line =~ /\b$logFunctions\s*\(.*$String/) {
> 
> I don't see the normal string formatting routines in that list... I think this is too restrictive.

I don't.  There are no "normal" string formatting routines.
What do you think is missing?  sn?printf ? That's easy to add.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] checkpatch: add warning on %pk instead of %pK usage william.c.roberts@intel.com - 2017-02-10 20:40 +0100
  Re: [PATCH] checkpatch: add warning on %pk instead of %pK usage Joe Perches <joe@perches.com> - 2017-02-10 21:20 +0100
    RE: [PATCH] checkpatch: add warning on %pk instead of %pK usage "Roberts, William C" <william.c.roberts@intel.com> - 2017-02-10 23:20 +0100
      RE: [PATCH] checkpatch: add warning on %pk instead of %pK usage "Roberts, William C" <william.c.roberts@intel.com> - 2017-02-10 23:30 +0100
        Re: [PATCH] checkpatch: add warning on %pk instead of %pK usage Joe Perches <joe@perches.com> - 2017-02-11 00:00 +0100
          Re: [PATCH] checkpatch: add warning on %pk instead of %pK usage Joe Perches <joe@perches.com> - 2017-02-11 00:00 +0100
          RE: [PATCH] checkpatch: add warning on %pk instead of %pK usage "Roberts, William C" <william.c.roberts@intel.com> - 2017-02-11 00:40 +0100
            Re: [PATCH] checkpatch: add warning on %pk instead of %pK usage Joe Perches <joe@perches.com> - 2017-02-11 00:50 +0100
          RE: [PATCH] checkpatch: add warning on %pk instead of %pK usage "Roberts, William C" <william.c.roberts@intel.com> - 2017-02-11 01:00 +0100
            Re: [PATCH] checkpatch: add warning on %pk instead of %pK usage Joe Perches <joe@perches.com> - 2017-02-11 01:10 +0100
          RE: [PATCH] checkpatch: add warning on %pk instead of %pK usage "Roberts, William C" <william.c.roberts@intel.com> - 2017-02-11 02:40 +0100
            Re: [PATCH] checkpatch: add warning on %pk instead of %pK usage Joe Perches <joe@perches.com> - 2017-02-11 04:30 +0100

csiph-web