Received: by 10.223.176.5 with SMTP id f5csp1933493wra; Thu, 8 Feb 2018 06:00:30 -0800 (PST) X-Google-Smtp-Source: AH8x2260iYtY0ygBB7uZjE+OXI4lPKBVKPvXZjESLZydyo+AW7SF2S69BV/S2bnShS5/x+6K9u/b X-Received: by 2002:a17:902:8304:: with SMTP id bd4-v6mr737592plb.123.1518098430620; Thu, 08 Feb 2018 06:00:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518098430; cv=none; d=google.com; s=arc-20160816; b=fWSW5SSE9mcb3irUxVTZFlUfanyu4KV15gMxsLf4tieODBKprxAQgmfy8hfaH7SG7G dVUecqrHqyvFyvNDwAmaC2CTifdICvCRoPlwGHPu6+S218+V3fUdAQBVcB2TaqdTfphr CUh6OHufz5t0gmnRIjdo6lnaW2t2X6OdYuqXiL+MsMCN+QhI/7fKxVAf/wzrYJk56xN4 9GM4ejEn95UqfqRYxkWcdFiHIo6XnsIAT4zuKBKTRRXOdvwVNwkXPGgD2MLOd1PYLA+W iQblMwG/O5KM0OMb77kXAmUmWDmRej7OSULv2Xy7xuE+6W+8eB8S/eRSkcaCT6PwJqmo OKRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=9ys7ggFr4GapAJFiAyj9i/3Hm7LPHNCGBNvYvil5BZg=; b=JS6C7MyokmRMBpYHkYtyKRzZFfiHIJroqbuUetnr5OQYSmngOnQoUnPUIDv5mJwuBg qPtVeTY83DBZOLhFq0VluroycUqNCK/RP08d1oybI+750HzpRM10PjYfYxwKlXljvxi0 ou38H0P+H0GZNeMiSrtj1uaCILcr6sPdSBm12rf7eNyaLeiL2qMy/I9fm4rZ4NmqcKV+ QSu7wrBAY6X/mE5eTOfBuWw2q/gzPYh1VCjQW6N56bEyNyvievr0SX9lauvhoOF7FsMZ z6XhmC1XxLq3NCQdbSM+OCS0lTbyiFcH/uWNTFAOTsMZ8sbqXcUl70Nerpm4Thenrj01 gxiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m2si2215pgs.86.2018.02.08.06.00.16; Thu, 08 Feb 2018 06:00:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752248AbeBHN7H (ORCPT + 99 others); Thu, 8 Feb 2018 08:59:07 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:64234 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751094AbeBHN7G (ORCPT ); Thu, 8 Feb 2018 08:59:06 -0500 X-IronPort-AV: E=Sophos;i="5.46,478,1511823600"; d="scan'208";a="254083239" Received: from vaio-julia.rsr.lip6.fr ([132.227.76.33]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Feb 2018 14:58:57 +0100 Date: Thu, 8 Feb 2018 14:58:56 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Dan Carpenter cc: Masahiro Yamada , Wolfram Sang , kernel-janitors@vger.kernel.org, Gilles Muller , Nicolas Palix , Michal Marek , cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: Re: [PATCH] scripts/coccinelle/misc/shift.cocci: detect < or > that should be a shift In-Reply-To: <20180208135350.e4yljburdpq7f5ny@mwanda> Message-ID: References: <1518094434-12852-1-git-send-email-Julia.Lawall@lip6.fr> <20180208135350.e4yljburdpq7f5ny@mwanda> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 8 Feb 2018, Dan Carpenter wrote: > On Thu, Feb 08, 2018 at 01:53:54PM +0100, Julia Lawall wrote: > > This checks for a comparison using < or > between two constants, > > considering both explicit constants (1, 2, etc) and macros defined > > with #define. False positives are possible in the latter case, when > > a macro may have multiple possible definitions and it is indeed > > necessary to check the value. There are currently two such false > > positives, in drivers/net/ethernet/chelsio/cxgb3/sge.c: > > > > q->fl[0].use_pages = FL0_PG_CHUNK_SIZE > 0; > > q->fl[1].use_pages = FL1_PG_CHUNK_SIZE > 0; > > > > We could eliminate both these false postives by ignoring >> vs >. Did > searching for > actually find any bugs? I think you were right that > right shifting a constant is way less common than left shifting and I > have some smatch scripts where I ignore right shifting bugs. > > On the other hand, two false positives are not a big deal. I found no bugs with > at the moment. I figured that the person could have just as easily written 0 < FL0_PG_CHUNK_SIZE, so it was not worth making a special case. But if anyone wants me to drop the case id > cst, then I can do that. thanks, julia