diff mbox

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

Message ID 1487024441.6214.12.camel@perches.com (mailing list archive)
State New, archived
Headers show

Commit Message

Joe Perches Feb. 13, 2017, 10:20 p.m. UTC
(Adding back the cc's)

On Mon, 2017-02-13 at 21:28 +0000, Roberts, William C wrote:
> <snip>
> > No worries.
> > No idea why it doesn't work for you.
> > Maybe the hand applying was somehow
> > faulty?
> > 
> > The attached is on top of -next so it does have offsets on Linus' tree, but it seems
> > to work.
> > 
> > (on -linux)
> > 
> > $ patch -p1 < cp_vsp.diff
> > patching file scripts/checkpatch.pl
> > Hunk #1 succeeded at 5634 (offset -36 lines).
> > 
> > $ cat t_block.c
> > {
> > 	MY_DEBUG(drv->foo,
> > 		 "%pk",
> > 		 foo->boo);
> > }
> > $ ./scripts/checkpatch.pl -f t_block.c
> > WARNING: Invalid vsprintf pointer extension '%pk'
> > #2: FILE: t_block.c:2:
> > +	MY_DEBUG(drv->foo,
> > +		 "%pk",
> > +		 foo->boo);
> > 
> > total: 0 errors, 1 warnings, 5 lines checked
> > 
> > NOTE: For some of the reported defects, checkpatch may be able to
> >       mechanically convert to the typical style using --fix or --fix-inplace.
> > 
> > t_block.c has style problems, please review.
> > 
> > NOTE: If any of the errors are false positives, please report
> >       them to the maintainer, see CHECKPATCH in MAINTAINERS.
> 
> 
> Applied. It works fine with your example (see attached 0001-tblock.patch) but it doesn't provide
> Output for me with 0002-drv-hack.patch (attached as well)
> 
> $ ./scripts/checkpatch.pl 0002-drv-hack.patch 
> total: 0 errors, 0 warnings, 10 lines checked
> 
> 0002-drv-hack.patch has no obvious style problems and is ready for submission.
> 
> ./scripts/checkpatch.pl 0001-tblock.patch 
> WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
> #13: 
> new file mode 100644
> 
> WARNING: Invalid vsprintf pointer extension '%pk'
> #19: FILE: t_block.c:2:
> +	MY_DEBUG(drv->foo,
> +		"%pk",
> +		 foo->boo);
> 
> total: 0 errors, 2 warnings, 6 lines checked
> 
> NOTE: For some of the reported defects, checkpatch may be able to
>       mechanically convert to the typical style using --fix or --fix-inplace.
> 
> 0001-tblock.patch has style problems, please review.
> 
> NOTE: If any of the errors are false positives, please report
>       them to the maintainer, see CHECKPATCH in MAINTAINERS.

This means _all_ the $stat checks aren't being done
on patches that add just a single multi-line statement.

Andrew?  Any thoughts on how to enable $stat appropriately
for patch contexts with a single multi-line statement?

Comments

Roberts, William C Feb. 15, 2017, 11:49 p.m. UTC | #1
> -----Original Message-----
> From: Joe Perches [mailto:joe@perches.com]
> Sent: Monday, February 13, 2017 2:21 PM
> To: Roberts, William C <william.c.roberts@intel.com>
> Cc: linux-kernel@vger.kernel.org; apw@canonical.com; kernel-
> hardening@lists.openwall.com
> Subject: Re: [PATCH] checkpatch: add warning on %pk instead of %pK usage
> 
> (Adding back the cc's)
> 
> On Mon, 2017-02-13 at 21:28 +0000, Roberts, William C wrote:
> > <snip>
> > > No worries.
> > > No idea why it doesn't work for you.
> > > Maybe the hand applying was somehow
> > > faulty?
> > >
> > > The attached is on top of -next so it does have offsets on Linus'
> > > tree, but it seems to work.
> > >
> > > (on -linux)
> > >
> > > $ patch -p1 < cp_vsp.diff
> > > patching file scripts/checkpatch.pl
> > > Hunk #1 succeeded at 5634 (offset -36 lines).
> > >
> > > $ cat t_block.c
> > > {
> > > 	MY_DEBUG(drv->foo,
> > > 		 "%pk",
> > > 		 foo->boo);
> > > }
> > > $ ./scripts/checkpatch.pl -f t_block.c
> > > WARNING: Invalid vsprintf pointer extension '%pk'
> > > #2: FILE: t_block.c:2:
> > > +	MY_DEBUG(drv->foo,
> > > +		 "%pk",
> > > +		 foo->boo);
> > >
> > > total: 0 errors, 1 warnings, 5 lines checked
> > >
> > > NOTE: For some of the reported defects, checkpatch may be able to
> > >       mechanically convert to the typical style using --fix or --fix-inplace.
> > >
> > > t_block.c has style problems, please review.
> > >
> > > NOTE: If any of the errors are false positives, please report
> > >       them to the maintainer, see CHECKPATCH in MAINTAINERS.
> >
> >
> > Applied. It works fine with your example (see attached
> > 0001-tblock.patch) but it doesn't provide Output for me with
> > 0002-drv-hack.patch (attached as well)
> >
> > $ ./scripts/checkpatch.pl 0002-drv-hack.patch
> > total: 0 errors, 0 warnings, 10 lines checked
> >
> > 0002-drv-hack.patch has no obvious style problems and is ready for submission.
> >
> > ./scripts/checkpatch.pl 0001-tblock.patch
> > WARNING: added, moved or deleted file(s), does MAINTAINERS need
> updating?
> > #13:
> > new file mode 100644
> >
> > WARNING: Invalid vsprintf pointer extension '%pk'
> > #19: FILE: t_block.c:2:
> > +	MY_DEBUG(drv->foo,
> > +		"%pk",
> > +		 foo->boo);
> >
> > total: 0 errors, 2 warnings, 6 lines checked
> >
> > NOTE: For some of the reported defects, checkpatch may be able to
> >       mechanically convert to the typical style using --fix or --fix-inplace.
> >
> > 0001-tblock.patch has style problems, please review.
> >
> > NOTE: If any of the errors are false positives, please report
> >       them to the maintainer, see CHECKPATCH in MAINTAINERS.
> 
> This means _all_ the $stat checks aren't being done on patches that add just a
> single multi-line statement.
> 
> Andrew?  Any thoughts on how to enable $stat appropriately for patch contexts
> with a single multi-line statement?

I'm for merging your patch as is, and then take up the fact that $stat is not working correctly
as a separate change, does that seem reasonable?
Joe Perches Feb. 16, 2017, 12:19 a.m. UTC | #2
On Wed, 2017-02-15 at 23:49 +0000, Roberts, William C wrote:
> > 
> > This means _all_ the $stat checks aren't being done on patches that add just a
> > single multi-line statement.
> > 
> > Andrew?  Any thoughts on how to enable $stat appropriately for patch contexts
> > with a single multi-line statement?
> 
> I'm for merging your patch as is, and then take up the fact that $stat is not working correctly
> as a separate change, does that seem reasonable?

Sure, Andrew Morton is the typical upstream path for checkpatch.
(cc'd)

Andy Whitcroft?  Any chance to look at this?
Roberts, William C Feb. 27, 2017, 4:26 p.m. UTC | #3
> -----Original Message-----
> From: Roberts, William C [mailto:william.c.roberts@intel.com]
> Sent: Wednesday, February 15, 2017 3:49 PM
> To: Joe Perches <joe@perches.com>
> Cc: linux-kernel@vger.kernel.org; apw@canonical.com; kernel-
> hardening@lists.openwall.com
> Subject: [kernel-hardening] RE: [PATCH] checkpatch: add warning on %pk instead
> of %pK usage
> 
> 
> 
> > -----Original Message-----
> > From: Joe Perches [mailto:joe@perches.com]
> > Sent: Monday, February 13, 2017 2:21 PM
> > To: Roberts, William C <william.c.roberts@intel.com>
> > Cc: linux-kernel@vger.kernel.org; apw@canonical.com; kernel-
> > hardening@lists.openwall.com
> > Subject: Re: [PATCH] checkpatch: add warning on %pk instead of %pK
> > usage
> >
> > (Adding back the cc's)
> >
> > On Mon, 2017-02-13 at 21:28 +0000, Roberts, William C wrote:
> > > <snip>
> > > > No worries.
> > > > No idea why it doesn't work for you.
> > > > Maybe the hand applying was somehow faulty?
> > > >
> > > > The attached is on top of -next so it does have offsets on Linus'
> > > > tree, but it seems to work.
> > > >
> > > > (on -linux)
> > > >
> > > > $ patch -p1 < cp_vsp.diff
> > > > patching file scripts/checkpatch.pl Hunk #1 succeeded at 5634
> > > > (offset -36 lines).
> > > >
> > > > $ cat t_block.c
> > > > {
> > > > 	MY_DEBUG(drv->foo,
> > > > 		 "%pk",
> > > > 		 foo->boo);
> > > > }
> > > > $ ./scripts/checkpatch.pl -f t_block.c
> > > > WARNING: Invalid vsprintf pointer extension '%pk'
> > > > #2: FILE: t_block.c:2:
> > > > +	MY_DEBUG(drv->foo,
> > > > +		 "%pk",
> > > > +		 foo->boo);
> > > >
> > > > total: 0 errors, 1 warnings, 5 lines checked
> > > >
> > > > NOTE: For some of the reported defects, checkpatch may be able to
> > > >       mechanically convert to the typical style using --fix or --fix-inplace.
> > > >
> > > > t_block.c has style problems, please review.
> > > >
> > > > NOTE: If any of the errors are false positives, please report
> > > >       them to the maintainer, see CHECKPATCH in MAINTAINERS.
> > >
> > >
> > > Applied. It works fine with your example (see attached
> > > 0001-tblock.patch) but it doesn't provide Output for me with
> > > 0002-drv-hack.patch (attached as well)
> > >
> > > $ ./scripts/checkpatch.pl 0002-drv-hack.patch
> > > total: 0 errors, 0 warnings, 10 lines checked
> > >
> > > 0002-drv-hack.patch has no obvious style problems and is ready for
> submission.
> > >
> > > ./scripts/checkpatch.pl 0001-tblock.patch
> > > WARNING: added, moved or deleted file(s), does MAINTAINERS need
> > updating?
> > > #13:
> > > new file mode 100644
> > >
> > > WARNING: Invalid vsprintf pointer extension '%pk'
> > > #19: FILE: t_block.c:2:
> > > +	MY_DEBUG(drv->foo,
> > > +		"%pk",
> > > +		 foo->boo);
> > >
> > > total: 0 errors, 2 warnings, 6 lines checked
> > >
> > > NOTE: For some of the reported defects, checkpatch may be able to
> > >       mechanically convert to the typical style using --fix or --fix-inplace.
> > >
> > > 0001-tblock.patch has style problems, please review.
> > >
> > > NOTE: If any of the errors are false positives, please report
> > >       them to the maintainer, see CHECKPATCH in MAINTAINERS.
> >
> > This means _all_ the $stat checks aren't being done on patches that
> > add just a single multi-line statement.
> >
> > Andrew?  Any thoughts on how to enable $stat appropriately for patch
> > contexts with a single multi-line statement?
> 
> I'm for merging your patch as is, and then take up the fact that $stat is not
> working correctly as a separate change, does that seem reasonable?

I haven't seen anything on list about your patch, are we kind of stuck or do you
have some plan on adding your stat patch in the future?
diff mbox

Patch

From 00191661141fb11abac22efe98ee58d37a9d9391 Mon Sep 17 00:00:00 2001
From: William Roberts <william.c.roberts@intel.com>
Date: Mon, 13 Feb 2017 11:35:03 -0800
Subject: [PATCH 2/2] drv hack

Signed-off-by: William Roberts <william.c.roberts@intel.com>
---
 drivers/char/applicom.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index e5c62dc..4f6934d 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -153,6 +153,10 @@  static int ac_register_board(unsigned long physloc, void __iomem *loc,
 		return 0;
 	}

+	MY_DEBUG(drv->foo,
+		"%pk",
+		foo->boo);
+
 	boardno--;
 
 	apbs[boardno].PhysIO = physloc;
-- 
2.7.4