From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753538AbbIPJMH (ORCPT ); Wed, 16 Sep 2015 05:12:07 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:30093 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753084AbbIPJMA (ORCPT ); Wed, 16 Sep 2015 05:12:00 -0400 X-AuditID: cbfec7f4-f79c56d0000012ee-22-55f9325d4918 Subject: Re: [PATCH] coccinelle: tests: unsigned value cannot be lesser than zero To: Julia Lawall References: <1442309232-5902-1-git-send-email-a.hajda@samsung.com> <55F816BC.5050407@users.sourceforge.net> <55F81A31.3040808@users.sourceforge.net> <55F82252.4090900@samsung.com> Cc: SF Markus Elfring , Bartlomiej Zolnierkiewicz , Gilles Muller , Joe Perches , Nicolas Palix , Michal Marek , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, cocci@systeme.lip6.fr Newsgroups: gmane.linux.kernel.janitors,gmane.linux.kernel,gmane.comp.version-control.coccinelle From: Andrzej Hajda Message-id: <55F93251.4010706@samsung.com> Date: Wed, 16 Sep 2015 11:11:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-version: 1.0 In-reply-to: Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmkeLIzCtJLcpLzFFi42I5/e/4Vd1Yo5+hBtdu6FhsnLGe1eLHptVs Fuc7lzNbzP55icli9v3HLBbLHpxmtNh6S9ri8q45bBZzWmexWRx7uZzJgcvj2LFWZo+9W7I8 vqy6xuzRt2UVo8f6LVdZPB4tu8/i0XSqndXj8ya5AI4oLpuU1JzMstQifbsEroyZbc8ZC87x VzTsOsPWwDiJp4uRk0NCwERiat9eRghbTOLCvfVsXYxcHEICSxklDvQtY4FwnjNKzFj9lwmk SlggWGLmvvtACQ4OEQF1id4PuRA1R5gk1u3uAOtmFrjBJPFnzhUWkAY+gSSJE8u/ga1gE9CU +Lv5JhuIzSugJXFmZisriM0ioCpxa+1XsLioQITEqbNvoWoEJX5Mvgc2h1PAUuJU531WkMXM AnoS9y9qgYSZBeQlNq95yzyBUXAWko5ZCFWzkFQtYGRexSiaWppcUJyUnmuoV5yYW1yal66X nJ+7iRESNV92MC4+ZnWIUYCDUYmH1+Hlj1Ah1sSy4srcQ4wSHMxKIryRCj9DhXhTEiurUovy 44tKc1KLDzFKc7AoifPO3fU+REggPbEkNTs1tSC1CCbLxMEp1cC47sa3GzN6pt6+oK8+Sf5u UF1A/QXXBpEFi7s++hnq/Z4uKxa1kS9Nb2ZyvynHwawNWunJXU9a9oTMub2g+dWyQyz3J774 +Lvb1+94pdWG7/uib6x17dpVMcVuzvMug7zJXOfuXFMt5Fgpcb9LdfIkoccKVhUvdF4vDXRd eYRL7ohX0zMe71e2SizFGYmGWsxFxYkASVtrYpYCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/15/2015 03:57 PM, Julia Lawall wrote: > > > On Tue, 15 Sep 2015, Andrzej Hajda wrote: > >> On 09/15/2015 03:31 PM, Julia Lawall wrote: >>> On Tue, 15 Sep 2015, SF Markus Elfring wrote: >>> >>>>>> v@p >>>>>> ( >>>>>> *< 0 >>>>>> | >>>>>> *<= 0 >>>>>> ) >>>>> It does not, and is not intended to, work. The branches of a disjunction >>>>> should be complete expressions. >>>> Will the following SmPL approach be more appropriate then? >>>> >>>> ( >>>> *v@p < 0 >>>> | >>>> *v@p <= 0 >>>> ) >>> Actually, all of >>> >>> v < 0 (never true) >>> v <= 0 (same as v == 0) >>> v >= 0 (always true) >>> >>> would seem to merit attention. Andrzej, what do you think? >> >> You are right, the 2nd case should be also addressed, >> such code is misleading. >> I will prepare then 2nd version of the patch. > > It could be reasonable to change the options to --all-includes? Although > it could be somewhat slow. I have tested the patch with 'v <= 0', it spotted hundreds places with this check. It seems to be quite common practice to use such checks with counters, iterators, quantities, range checking. In fact it is negation of 'v > 0' which seems to be acceptable even if it really means 'v != 0'. So maybe we should not warn about it? What do you think? On the other side it spotted also real bugs, but maybe I can make separate, more specific test for such cases. Regards Andrzej > > julia > >> >> Regards >> Andrzej >> >>> >>> julia >>> >>> >>>> Regards, >>>> Markus >>>> -- >>>> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in >>>> the body of a message to majordomo@vger.kernel.org >>>> More majordomo info at http://vger.kernel.org/majordomo-info.html >>>> >> >> > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >