From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752637AbdBJWuH (ORCPT ); Fri, 10 Feb 2017 17:50:07 -0500 Received: from smtprelay0073.hostedemail.com ([216.40.44.73]:34862 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751131AbdBJWuG (ORCPT ); Fri, 10 Feb 2017 17:50:06 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3653:3865:3866:3867:3868:3870:3871:3873:3874:4321:5007:7576:7904:9010:10004:10400:10848:11026:11232:11658:11914:12043:12048:12555:12740:12760:12895:13069:13311:13357:13439:14181:14659:14721:21080:21451:30054:30064:30070:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:31,LUA_SUMMARY:none X-HE-Tag: debt49_706801f4a49 X-Filterd-Recvd-Size: 2816 Message-ID: <1486766996.2192.30.camel@perches.com> Subject: Re: [PATCH] checkpatch: add warning on %pk instead of %pK usage From: Joe Perches To: "Roberts, William C" , "linux-kernel@vger.kernel.org" , "apw@canonical.com" , Andew Morton Cc: "keescook@chromium.org" , "kernel-hardening@lists.openwall.com" Date: Fri, 10 Feb 2017 14:49:56 -0800 In-Reply-To: <476DC76E7D1DF2438D32BFADF679FC562305C5BA@ORSMSX103.amr.corp.intel.com> References: <1486755469-21573-1-git-send-email-william.c.roberts@intel.com> <1486757549.2192.20.camel@perches.com> <476DC76E7D1DF2438D32BFADF679FC562305C559@ORSMSX103.amr.corp.intel.com> <476DC76E7D1DF2438D32BFADF679FC562305C5BA@ORSMSX103.amr.corp.intel.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.3-0ubuntu0.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2017-02-10 at 22:26 +0000, Roberts, William C wrote: > > > > > > > > On Fri, 2017-02-10 at 11:37 -0800, william.c.roberts@intel.com wrote: > > > > From: William Roberts > > > > > > > > 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 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 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.