From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753218AbdLEP12 (ORCPT ); Tue, 5 Dec 2017 10:27:28 -0500 Received: from smtprelay0167.hostedemail.com ([216.40.44.167]:45930 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753087AbdLEP1W (ORCPT ); Tue, 5 Dec 2017 10:27:22 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 30,2,0,,d41d8cd98f00b204,joe@perches.com,:::::::,RULES_HIT:41:355:379:541:599:800:960:966:968:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2196:2197:2198:2199:2200:2201:2393:2553:2559:2562:2692:2828:2892:2917:3138:3139:3140:3141:3142:3355:3622:3653:3865:3866:3867:3868:3870:3871:3872:3873:4321:4385:5007:10004:10400:10848:11026:11232:11658:11914:12043:12295:12296:12663:12740:12760:12895:13439:14181:14659:14721:21080:21221:21326:21451:21505:21627:30029:30054:30070:30075:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:3,LUA_SUMMARY:none X-HE-Tag: cakes24_5d254fd7b2a19 X-Filterd-Recvd-Size: 3436 Message-ID: <1512487638.6321.80.camel@perches.com> Subject: Re: [PATCH] checkpatch: warn for use of %px From: Joe Perches To: "Tobin C. Harding" Cc: Andrew Morton , Andy Whitcroft , linux-kernel@vger.kernel.org Date: Tue, 05 Dec 2017 07:27:18 -0800 In-Reply-To: <20171205094432.GA11064@eros> References: <1512422224-29827-1-git-send-email-me@tobin.cc> <1512458664.6321.71.camel@perches.com> <20171205094432.GA11064@eros> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-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 Tue, 2017-12-05 at 20:44 +1100, Tobin C. Harding wrote: > On Mon, Dec 04, 2017 at 11:24:24PM -0800, Joe Perches wrote: > > On Tue, 2017-12-05 at 08:17 +1100, Tobin C. Harding wrote: > > > Usage of the new %px specifier potentially leaks sensitive > > > inforamtion. Printing kernel addresses exposes the kernel layout in > > > > information > I don't understand this comment? Do you mean the wording is wrong? > I'll re-word as suggested below. It's just a spelling typo correction. [] > > > Suggested-by: Andrew Morton > > > Signed-off-by: Tobin C. Harding > > > Co-Developed-by: Joe Perches > > > Are you happy with this tagging? Needs your signed-off-by still. I think signatures tags are pretty freeform and I'm not particularly concerned about them. I think Andrew Morton may object and change it or remove it. Have an: Acked-by: Joe Perches if the spellos and style bits are changed. > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > > > > [] > > > @@ -1612,6 +1612,17 @@ sub raw_line { > > > return $line; > > > } > > > > > > +sub stat_real { > > > + my ($linenr, $lc) = @_; > > > + > > > + my $stat_real = raw_line($linenr, 0); > > > + for (my $count = $linenr + 1; $count <= $lc; $count++) { > > > + $stat_real = $stat_real . "\n" . raw_line($count, 0); > > > + } > > > + > > > + return $stat_real; > > > +} > > > > If you are going to make a subroutine of this > > there are some other places it could be used too. > > Ok, I'm not super happy with sub routine name. Have you a better suggestion? Maybe get_stat_real? > > > + > > > sub cat_vet { > > > my ($vet) = @_; > > > my ($res, $coded); > > > @@ -5747,24 +5758,35 @@ sub process { > > > defined $stat && > > > $stat =~ /^\+(?![^\{]*\{\s*).*\b(\w+)\s*\(.*$String\s*,/s && > > > $1 !~ /^_*volatile_*$/) { > > > - my $bad_extension = ""; > > > + my ($specifier, $extension, $stat_real); > > > > My preference is not to define multiple variables on a single line. > > I'd rather have: > > my $specifier; > > my $extension; > > my $stat_real; > > No problem, is this a kernel wide thing or just a checkpatch thing (so I > can follow your lead if need be in leaking_addresses.pl). Or is it the > same as we do in C, in which case $extension and $specifier could be on > a single line but not $stat_real? It's a personal preference. Perl can have pretty cryptic constructs and I prefer reading it like C.