From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752201AbdBJXtk (ORCPT ); Fri, 10 Feb 2017 18:49:40 -0500 Received: from smtprelay0168.hostedemail.com ([216.40.44.168]:36752 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751326AbdBJXti (ORCPT ); Fri, 10 Feb 2017 18:49:38 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::,RULES_HIT:41:355:379:541:599:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:4321:4470:5007:6119:7903:7904:8792:9108:10004:10226:10400:10450:10455:10848:11232:11658:11914:12048:12740:12760:12895:13069:13132:13231:13311:13357:13439:14659:14721:19904:19999:21080:21220:21434:30054:30069:30070:30091,0,RBL:error,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:error,Custom_rules:0:0:0,LFtime:2000,LUA_SUMMARY:none X-HE-Tag: feast81_537a16cc86f3b X-Filterd-Recvd-Size: 2422 Message-ID: <1486770571.2192.36.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" , Julia Lawall , Emese Revfy Date: Fri, 10 Feb 2017 15:49:31 -0800 In-Reply-To: <476DC76E7D1DF2438D32BFADF679FC562305DB22@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> <1486766996.2192.30.camel@perches.com> <476DC76E7D1DF2438D32BFADF679FC562305DB22@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 (adding Emese Revfy and Julia Lawall) On Fri, 2017-02-10 at 23:31 +0000, Roberts, William C wrote: > The problem starts to get hairy when we think of how often folks roll their own logging macros (see some small sampling at the end). > > I think we would want to add DEBUG DBG and sn?printf and maybe consider dropping the \b on the regex so it's a bit more matchy but still shouldn't > end up matching on any ASM as you pointed out in the V2 nack. > > Ill break this down into: > 1. the patch as I know you'll take it, as you wrote it :-P > 2. Adding to the logging macros > 3. exploring making it less matchy checkpatch is a line-oriented bunch of regexes and doesn't know what is a __printf format. It won't ever be "perfect" for this sort of format verification checking. Another way to do this is to write a gcc compiler plugin that verifies the %p format types and emits a warning/error. That's probably the "best" solution. Maybe coccinelle could help too.