From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: Re: [PATCH] fs/compat: remove redundant 'less than zero' check Date: Fri, 24 Apr 2015 16:00:29 +0300 Message-ID: <20150424130029.GD16501@mwanda> References: <1429870070-30310-1-git-send-email-firogm@gmail.com> <20150424120453.GO14154@mwanda> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Firo Yang , viro@zeniv.linux.org.uk, kernel-janitors@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Julia Lawall Return-path: Received: from userp1040.oracle.com ([156.151.31.81]:42294 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752517AbbDXNAg (ORCPT ); Fri, 24 Apr 2015 09:00:36 -0400 Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Apr 24, 2015 at 02:23:23PM +0200, Julia Lawall wrote: > On Fri, 24 Apr 2015, Dan Carpenter wrote: > > > On Fri, Apr 24, 2015 at 06:07:50PM +0800, Firo Yang wrote: > > > > > - if (nr_segs > UIO_MAXIOV || nr_segs < 0) > > > + if (nr_segs > UIO_MAXIOV) > > > > Linus said at kernel summit that he thinks this kind of checks are ok. > > > > Smatch already ignores checks like: > > > > if (nr_segs < 0 || nr_segs > UIO_MAXIOV) > > > > So making it ignore this one as well shouldn't be hard... I'll change > > Smatch to ignore this one as well. > > It is unsigned. What is the point of cluttering the code? I guess I don't feel strongly either way. It was Linus who said something like "the intent is clear from the code" so he isn't a fan of these particular static checker fixes. These are easy enough for me to filter out so they needn't cause a false positive. They're more of a style issue than anything else. With coccinelle, it's easier to care about style issues because you can fix them automatically. In Smatch caring about style issues is a time suck. regards, dan carpenter