Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp480516ybl; Tue, 7 Jan 2020 09:26:33 -0800 (PST) X-Google-Smtp-Source: APXvYqzQeroUutqJhedDDmyd3upuUC4dFg65J1BrKdMsyZt0a83tx0wAXesvsuTZ2NkEN88DwA43 X-Received: by 2002:a9d:4e97:: with SMTP id v23mr805843otk.201.1578417993203; Tue, 07 Jan 2020 09:26:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578417993; cv=none; d=google.com; s=arc-20160816; b=DaiIeAsCmiY4qhkxXFSxxsuDo1tJaDi/y948r43b0m7iHdWSeBbjxXZzsnVZ7/nSvd Y4LCGO8epfgYUx/GU04mAJVZwxPWHira4wiCAy9EB2z7K5q2fycIP8/tPSVC2MrPnSIt ZFWrTosOEKl6Ve47dDofbaGXFLB/MPUnuh9CirtkvUZPwAk7KDN9Oqx+mA//IafP0huN uAUrfK30zRBJ8AoXFtHd8PTNEL/o3+7r549C7RCGsyAxQHtUJYzySwx5o9di/E4REvEc LVvIxfVKsOWpMkO9xxtSkUnjYfbSLWE970YSEPpVIfQZtrF9URvMa1n+3B9VPAT57GM4 BxEQ== 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; bh=lB9F4PsvNd+A+dPP95hpul2W02WyC2Ejxjctw8x31GA=; b=yO3//uf3udRTRmBdDnnx7LiMkEUaVMT+pIzX/Gs2CczgJn7EQf3B2mUhKdsR1a/6my K5VDlyeshCHXSRWnWwAPkVSPk7PMWALrNIhtRDtzwew9BHQrjdMenyqiu4DfCWcM49DQ oAA6ksPbAQmh4Z5wB8lP9QBq82aaDGkznuKkhfbL08ddsjwit7CRcqftvsjW0u0Jhmoh Ghcs2fAiCD6YaNSndPM+524R92cSoonLi8U7CtYvHfIswtXBfTAZF/Br+QJHKlUMD4rS POYyoHnWJbKoGTW6wiIc8/iBXvcCT5d3xhRzWKrqCZmaQzqUKNOaLA1HAQ6t6ftQoMSF BJHw== 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 e1si203998otj.276.2020.01.07.09.26.19; Tue, 07 Jan 2020 09:26:33 -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 S1728461AbgAGRZK (ORCPT + 99 others); Tue, 7 Jan 2020 12:25:10 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:48215 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728344AbgAGRZJ (ORCPT ); Tue, 7 Jan 2020 12:25:09 -0500 X-IronPort-AV: E=Sophos;i="5.69,406,1571695200"; d="scan'208";a="335054412" Received: from dt-lawall.paris.inria.fr ([128.93.67.65]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Jan 2020 18:25:07 +0100 Date: Tue, 7 Jan 2020 18:25:07 +0100 (CET) From: Julia Lawall X-X-Sender: julia@hadrien To: Wen Yang cc: Gilles Muller , Nicolas Palix , Michal Marek , Matthias Maennich , Greg Kroah-Hartman , Masahiro Yamada , Thomas Gleixner , cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] coccinelle: semantic patch to check for inappropriate do_div() calls In-Reply-To: <20200107170240.47207-1-wenyang@linux.alibaba.com> Message-ID: References: <20200107170240.47207-1-wenyang@linux.alibaba.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) 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 > +@depends on context@ > +expression f; > +long l; > +unsigned long ul; > +u64 ul64; > +s64 sl64; > + > +@@ > +( > +* do_div(f, l); > +| > +* do_div(f, ul); > +| > +* do_div(f, ul64); > +| > +* do_div(f, sl64); > +) This part is not really ideal. For the reports, you filter for the constants, but here you don't do anything. You can put some python code in the matching of the metavariables: unsigned long ul : script:python() { whatever you want to check on ul }; Then it will only match if the condition is satisfied. julia