Received: by 10.223.176.5 with SMTP id f5csp770736wra; Wed, 7 Feb 2018 07:17:36 -0800 (PST) X-Google-Smtp-Source: AH8x226bS1BDqzDVcq4ZzOsPR9oiH3ZVnMAMnrJ5CrBiYPT/Qlk0i1OXLK7fUiwQ/xs2CWLvSjuz X-Received: by 2002:a17:902:8e83:: with SMTP id bg3-v6mr6473814plb.246.1518016656144; Wed, 07 Feb 2018 07:17:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518016656; cv=none; d=google.com; s=arc-20160816; b=BTQTYmHWXmOAVmzw8bjO7KQ8Ac17+WKV1lcASg/3r3GAgmv+Nm6SR0/raGlp5qHg5D mQw8H99Mfwlkw0U+385XSfDG7AC1Vt1eExsVBRacdxkSlLCehxNxSfkDLO8apUQicbdN mv0NNVk8qjlEkgRoU5Fg5Oxi+0fuUcSqZHsr3R5fafrVeqyR9HSat5z877sfaAcHYeWo sLrZ6O3N28s9EsgiVqjaJ94VbSKHMIllumLI/lbsp4DlUlXkTtlwgSIWOoiOENwhjGw+ XcbKPlNzCXlauWZRpOZqyi/LBWrRjov8OKcgUStdWbCVFNugar82fFMpe/p6pO3ljdYG fhEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=APt7ogxKPKwixKAxxm7XiTm1TNTEJsFolo2A9bQkiDU=; b=ySP/9XMBSWWGPGp+HmCvuM4z7YA9uIDV2Cup8yQETTxUj3To8DdWHOwv/Gdst6wRnh NcIX2tMqQ3J3+/JAAhXerOJKYp1xB7KZPG9s3QFf/zDUrLOQcIRBaLuecZCIiuxYrhZD N7gnw/88xH0UHttOe9oBAP+TM7eiusT9HxBVGDdXwMdexgkT4SWNpRHjbVyyXDoT9CDZ 7zZn4ch7lsKOa5kYb23njC3dwTE0hDBkIoq+jUXOzh9D5XoOuXfTwJdViOs6T6e0fMfl KAJMl3yxFo3BJklhjxGZFxOne+Q8JtsMy99wHFVRv+z6bPRbWpLqUbFruQdTbW+9QPxo lbow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=zNuJawie; 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 f9-v6si1187934pli.321.2018.02.07.07.17.21; Wed, 07 Feb 2018 07:17:36 -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=@nifty.com header.s=dec2015msa header.b=zNuJawie; 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 S1754497AbeBGPQM (ORCPT + 99 others); Wed, 7 Feb 2018 10:16:12 -0500 Received: from conssluserg-02.nifty.com ([210.131.2.81]:20471 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754254AbeBGPQL (ORCPT ); Wed, 7 Feb 2018 10:16:11 -0500 Received: from mail-ua0-f173.google.com (mail-ua0-f173.google.com [209.85.217.173]) (authenticated) by conssluserg-02.nifty.com with ESMTP id w17FFsHS010465; Thu, 8 Feb 2018 00:15:54 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com w17FFsHS010465 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1518016555; bh=APt7ogxKPKwixKAxxm7XiTm1TNTEJsFolo2A9bQkiDU=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=zNuJawielIfq3KGHT2mxoXLrxtwKEUnIzJErljwjtr1SVCksDCvfE1YloyTX1BXRk 7C27CHVVcy72dM0y7/uUdSkmW1VUXSgH8nYcctSZM4F6POQrD2BS1u3npQCKlJ/7Dx dnMUMV7/YQ1lWwq+Tw8Au7MkYYZtoqvhFDgwiBuqUhp0mjihxwAFYZLaoQF4dkeoQ+ fVWnh2eGENTrBcfjkEq7ihWZ39Oml9qfrHhRKK4MYOuJnsXkwaWo5Yc0I090KSa65k ajmuxlJg1ULJyG+CxvR80DFgHVDkPgeDfW01e0EpKuPX5V4L/eBC+7UCjpwl6FLyRf G1+mlGw+tQSRw== X-Nifty-SrcIP: [209.85.217.173] Received: by mail-ua0-f173.google.com with SMTP id i15so755751uak.3; Wed, 07 Feb 2018 07:15:54 -0800 (PST) X-Gm-Message-State: APf1xPCD+yCI7Acn6erAfzQIaWMcQPJZCUaW89J6rtu6KqOOZG7A7gu5 hsWHXkWD6NCW5/dnNJ9tctcNM0xCcdVBOrSupKo= X-Received: by 10.176.6.98 with SMTP id f89mr415170uaf.181.1518016553616; Wed, 07 Feb 2018 07:15:53 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.83.212 with HTTP; Wed, 7 Feb 2018 07:15:13 -0800 (PST) In-Reply-To: <1517478532-5444-1-git-send-email-Julia.Lawall@lip6.fr> References: <1517478532-5444-1-git-send-email-Julia.Lawall@lip6.fr> From: Masahiro Yamada Date: Thu, 8 Feb 2018 00:15:13 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] coccinelle: reduce false positives To: Julia Lawall Cc: kernel-janitors@vger.kernel.org, Gilles Muller , Nicolas Palix , Michal Marek , cocci@systeme.lip6.fr, Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-02-01 18:48 GMT+09:00 Julia Lawall : > Some files use both a non-devm allocation and a devm_allocation. Don't > complain about a free when the same function contains a non-devm > allocation. > > Signed-off-by: Julia Lawall > > --- > scripts/coccinelle/free/devm_free.cocci | 55 +++++++++++++++++++++++++++++++- > 1 file changed, 54 insertions(+), 1 deletion(-) > > diff --git a/scripts/coccinelle/free/devm_free.cocci b/scripts/coccinelle/free/devm_free.cocci > index c990d2c..b2a2cf8b 100644 > --- a/scripts/coccinelle/free/devm_free.cocci > +++ b/scripts/coccinelle/free/devm_free.cocci > @@ -56,9 +56,62 @@ expression x; > x = devm_ioport_map(...) > ) > > +@safe depends on context || org || report exists@ > +expression x; > +position p; > +@@ > + > +( > + x = kmalloc(...) > +| > + x = kvasprintf(...) > +| > + x = kasprintf(...) > +| > + x = kzalloc(...) > +| > + x = kmalloc_array(...) > +| > + x = kcalloc(...) > +| > + x = kstrdup(...) > +| > + x = kmemdup(...) > +| > + x = get_free_pages(...) > +| > + x = request_irq(...) > +| > + x = ioremap(...) > +| > + x = ioremap_nocache(...) > +| > + x = ioport_map(...) > +) > +... > +( > + kfree@p(x) > +| > + kzfree@p(x) > +| > + __krealloc@p(x, ...) > +| > + krealloc@p(x, ...) > +| > + free_pages@p(x, ...) > +| > + free_page@p(x) > +| > + free_irq@p(x) > +| > + iounmap@p(x) > +| > + ioport_unmap@p(x) > +) > + > @pb@ > expression r.x; > -position p; > +position p != safe.p; > @@ > > ( > Anyway, it looks like this patch makes the situation better. Applied to linux-kbuild/kbuild. Thanks! -- Best Regards Masahiro Yamada