Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp689730ybl; Fri, 10 Jan 2020 05:13:35 -0800 (PST) X-Google-Smtp-Source: APXvYqyBb5Hsby6bQLuQYJkqxZ88kHOTeLz66U3L0B2ZyqlUn7u8z9KQ0xTyFxNh8AUHdIvJuytM X-Received: by 2002:a9d:7f12:: with SMTP id j18mr2632029otq.17.1578662015104; Fri, 10 Jan 2020 05:13:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578662015; cv=none; d=google.com; s=arc-20160816; b=vuIZiU52bAV4EkuoZsEuQNyq6Nvz3slh7L75v2nD8qC8Gz7RQnZyW2YzkSH4hl8nTM TdMTYZE/mm9zSOvoOp/UR7xv+gjclgSWGmyTSh+LfAgTGK3cEzzNJTXwTaK2m8P3QcZJ BidAoz1FpzYH2wwpFFwPiM6WD+PE6y5tepxkus+XH/J41ncmXtAcbBzEidxUBCgxSAxa eht5PJKAudrlwkYVpFwA1EAcKEuJ1E3dRO7Ou3h1y3jhN2nU3oO4S9y60BXD1dNm91eT sZ5yXx91aYQC6h+fk3Zcyu8dmLmooNUVkk/C2x9ogwsiTfgRDna/248cBPTJDJOU7m1T P66A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=aCx7YVVp/u/f+OSS0jc9E1K7wHCxF8QulQdzF1yeHNc=; b=QF4lASj1ZrD7WcH2/cbGQd6Cd30RroJmFETETW7DH8Iq4L7Ui5zHu1bb5SUDH3opa8 9MJeUrequs8tDanFuDQSm1yJxvIn6lLIQP+Ru/8FuVF9CNyZoxYAFFIetHcV9XeYhsFI 6DuWAyXsXcHr2M5vltSPPjss+UopKFo2hOM4dk9hwtu/3bLFhH2M6AX2aYC/F5TLIazZ LiRNFxgN26oEYEMtYnJ8Gyf6S4FuZ0mgaJBlOYJJUFS0VR/5IGi5064+Jo9BH+KOgooc jQOtuVGf2IrI3h8nyyJErs3cnSXaUCjFdHX3lqx+Htcnz3PKr837oI0Sac49s6W1R/eO ABTA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b12si1194386otl.229.2020.01.10.05.13.22; Fri, 10 Jan 2020 05:13:35 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727427AbgAJNMT (ORCPT + 99 others); Fri, 10 Jan 2020 08:12:19 -0500 Received: from out30-44.freemail.mail.aliyun.com ([115.124.30.44]:48733 "EHLO out30-44.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727374AbgAJNMT (ORCPT ); Fri, 10 Jan 2020 08:12:19 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R381e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e01422;MF=wenyang@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0TnKMqhn_1578661869; Received: from IT-C02W23QPG8WN.local(mailfrom:wenyang@linux.alibaba.com fp:SMTPD_---0TnKMqhn_1578661869) by smtp.aliyun-inc.com(127.0.0.1); Fri, 10 Jan 2020 21:11:11 +0800 Subject: Re: [PATCH v2] coccinelle: semantic patch to check for inappropriate do_div() calls To: Julia Lawall 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 References: <20200107170240.47207-1-wenyang@linux.alibaba.com> From: Wen Yang Message-ID: Date: Fri, 10 Jan 2020 21:11:08 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/1/8 1:25 上午, Julia Lawall wrote: >> +@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 > OK, thank you very much. We'll fix it soon. -- Best Wishes, Wen