From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752170AbbH0HWo (ORCPT ); Thu, 27 Aug 2015 03:22:44 -0400 Received: from smtprelay0252.hostedemail.com ([216.40.44.252]:54983 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751061AbbH0HWn (ORCPT ); Thu, 27 Aug 2015 03:22:43 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::,RULES_HIT:41:355:379:541:599:800:960:968:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1539:1593:1594:1711:1730:1747:1777:1792:2393:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3868:3872:3873:4321:5007:6261:7576:7904:10004:10400:10848:11232:11658:11914:12517:12519:12740:13069:13311:13357:21080,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 X-HE-Tag: honey72_1759e9b9cbf0b X-Filterd-Recvd-Size: 1956 Message-ID: <1440660159.11525.79.camel@perches.com> Subject: Re: [PATCH] checkpatch: add --strict "pointer comparison to NULL" test From: Joe Perches To: Nicolas Morey Chaisemartin Cc: Viresh Kumar , Andrew Morton , Dan Carpenter , Greg KH , LKML , Mike Holmes Date: Thu, 27 Aug 2015 00:22:39 -0700 In-Reply-To: <975828790.5069815.1440659347329.JavaMail.zimbra@kalray.eu> References: <1415905054.4223.7.camel@perches.com> <1440644737.11525.64.camel@perches.com> <975828790.5069815.1440659347329.JavaMail.zimbra@kalray.eu> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 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 Thu, 2015-08-27 at 09:09 +0200, Nicolas Morey Chaisemartin wrote: > > From: "Joe Perches" [] > > And because most likely, "CONST test variable" checks like > > NULL != foo > > and > > 0 < bar > > > > should probably be a separate test. [] > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > > + if ($comp eq "<") { > > + $newcomp = ">="; > > + } elsif ($comp eq "<=") { > > + $newcomp = ">"; > > + } elsif ($comp eq ">") { > > + $newcomp = "<="; > > + } elsif ($comp eq ">=") { > > + $newcomp = "<"; > > + } > > I like the concept but are you sure about this? > I think the "=" should be added or removed. If a < b, b > a, not b >= a. Right thanks, it's obviously incorrect.