Received: by 10.223.176.5 with SMTP id f5csp1931389wra; Thu, 8 Feb 2018 05:58:28 -0800 (PST) X-Google-Smtp-Source: AH8x225r9tyFALuagdXuqmBGPfCmjEfwMAKCn3v2UHKm4atoXXtK/BtfMCTzLB5CjgD/IBql7o0L X-Received: by 10.98.88.131 with SMTP id m125mr803735pfb.178.1518098308645; Thu, 08 Feb 2018 05:58:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518098308; cv=none; d=google.com; s=arc-20160816; b=EIliqHdPG8a81BG+eax1fabtfpX18/wNXusqnOHBVs5FJA+gQBpRRPbumB8jdQ/+K8 F8qrmQ2KWvLiF22q9EOyOzlbbTlYADeE1ecPMBtUHvFRG8lnHpdFLOxqBHYDVKg9YaVC bNhedCQd5FiB2KEAJYV37dh7b3KcSGIqgw8UgDGk+aOv/IEhkeLIFH3npW/GnZoLWSuV hQJM/IFwFVomwWEEVESgENMFJEqrahPH0NMNafGisFxMkMV9nZK2ZsMTgO6UA0nlsbuB cgz2DLcmHtoiN5jbsrSDzcy7A0XyxDPCdvcLaypNkGsGN/LH9Q+kGf6cSdtuPzjt4Cq7 B+Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=PADB4b2bg+xkfStgUKTPxK6mWiPw5BaHff3MUYO5odQ=; b=UhSZsQ2po0U0EeKTvVu0oXUj5Y9oXtsP+rszuXlTwmnZxjOHFetBNSsAfkpxgp0Swj pH87lcq/pWJAMMqoMEhm3xgUvv6dG/YpRgDgsAaS7F/nMhxwhWwMUxP1TaXQifyKm96c JX5fTJklGYMYcQUj5tWw+xBAkbhoc6g68BTeYoLSdcPyAEcozwCHXr2hMONmch+rwxLM q7J9LikRUYMgbhKn0pyFg86dPnZHTqJrmHUJbJGP7H7NliDb25v0ctHQna80q39gcW8C Ad0mfxhly15eQ1vU0atRO8frCbYzXf+/I7hV5tGAkODWAsDP80umcxIEb80atUlgMQBr RSLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=KQbbTkY4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f6si5431pgn.336.2018.02.08.05.58.14; Thu, 08 Feb 2018 05:58:28 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=KQbbTkY4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752337AbeBHN4z (ORCPT + 99 others); Thu, 8 Feb 2018 08:56:55 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:48664 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752215AbeBHNy3 (ORCPT ); Thu, 8 Feb 2018 08:54:29 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w18DpqFV186872; Thu, 8 Feb 2018 13:54:08 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2017-10-26; bh=PADB4b2bg+xkfStgUKTPxK6mWiPw5BaHff3MUYO5odQ=; b=KQbbTkY4Goc84pM4JVcoDQUwlogCeYH5cLKOuos5A27ed1zsox1jiR33pQiJ/javJbfJ reimYPc3iV5dGaj9hYhWF/pCUeoI8lKW8pCyxslFkB3GgTa9GkfkC5QaUkFD9FlHKAHq NlhADNMl5xp/Azt0QpQmWOQNP2Oj9sVQd1/1rrO0hZtpJPmCznm8FfQwiep3iXrKQTzr kc/Sgej7hCOvLkc+MF58kQB8yjz5s1gALvqYiKBD195r46zir5kbe5fT79bI0/9blD2x YgJVjGI1Zc2HepsGTdhxKhpuUQavfFuocFeyVfdSua3iOV7Awm1mNqdjuGwJCSidntI0 Sw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2g0q21g7f8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Feb 2018 13:54:08 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w18Ds5Gh029506 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Feb 2018 13:54:06 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w18Ds2aB020120; Thu, 8 Feb 2018 13:54:03 GMT Received: from mwanda (/197.254.35.146) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 08 Feb 2018 05:54:02 -0800 Date: Thu, 8 Feb 2018 16:53:50 +0300 From: Dan Carpenter To: Julia Lawall 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 Message-ID: <20180208135350.e4yljburdpq7f5ny@mwanda> References: <1518094434-12852-1-git-send-email-Julia.Lawall@lip6.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1518094434-12852-1-git-send-email-Julia.Lawall@lip6.fr> User-Agent: NeoMutt/20170609 (1.8.3) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8798 signatures=668663 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802080162 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. regards, dan carpenter