Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp24138ybh; Mon, 20 Jul 2020 09:27:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJywcdHZ5teGH1JdTUErslKjZ8lTDZ2Kep5Hzcp3yMfipypMxzfYvs5b6M7m8qo0p1H/Hu7I X-Received: by 2002:a17:906:899:: with SMTP id n25mr20210617eje.298.1595262424518; Mon, 20 Jul 2020 09:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595262424; cv=none; d=google.com; s=arc-20160816; b=vKR2XoGQryDD8h59ILwr7CMw28YAoEb1VjOKMa9wAF2T9XjDGbflzQIyYlYcTk1CN3 WOnqyAMSNnD7HovBNOCURzilWAJx7fybboh0UlmioKGeWVyrWgjtkbvGnrlAEFE8B097 TD0Qf+V441oUnvEFYtH4kWb6LMmUAwEiAlyETboFnjclzFhtjIys7vnDVBFqWUyFToqd SzZgAVySA+FFDbQd0pQTiQIPyvJJYOkyVry8cX4Xh9PWb18w677JZLH6K3JJcvFXXdve Ob2k4r1uRPBmwGmE0/7F2Y2MJ4L9t7KhZV2vEfutyL3PUjfJcmWf4FwoEO96bgi/2pcv VeyA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=N8ZQ1z1Y9J3lklmnyIL1eg+foE3QYmPpQxCfPP1w6Ms=; b=hOUB1usIzPsUJ6bLfEz0HEk8FU/B46xXDUxMJsPEWqbMOFpjoI9aiNsrYfK4AfCnIc wevum1sK3bl40XRs79XDWzL7Up6y9WQba+Sxzc9Ljv3PpAbfJ90HW4DI1sMh75iikw8d 6RpDOaO3mXsdc+H8a4EyEEhucVYQd/hMuC8gKyizzGNRQgDRo/AC4WEnozTcyp5j6pGF o4UCF+XJltfXBjhpUGK21SNhNRuaaCGOfwRWO6HUqto3cVbL1VNucFogC2qX0hSsE1CH 4QinhtexRy+FOSeajk8yTcO6/8P685YAJc8CtoRoybh4qdlN/TRpTfCaQkKacWNAK48j k3JQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x6si11350297ejw.73.2020.07.20.09.26.41; Mon, 20 Jul 2020 09:27:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388725AbgGTQXL (ORCPT + 99 others); Mon, 20 Jul 2020 12:23:11 -0400 Received: from mail-lf1-f47.google.com ([209.85.167.47]:35384 "EHLO mail-lf1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730651AbgGTQXI (ORCPT ); Mon, 20 Jul 2020 12:23:08 -0400 Received: by mail-lf1-f47.google.com with SMTP id u12so10032008lff.2 for ; Mon, 20 Jul 2020 09:23:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N8ZQ1z1Y9J3lklmnyIL1eg+foE3QYmPpQxCfPP1w6Ms=; b=rdKWVaYpc45vWah6ZYTSHlJlE9oU72q5NaV0Lry3tLzENi9T9W77KxjhEsBV8Dwj+8 4DEzSlZsGhyoVkE+91T3yllIrwdZm6d9Yj4i6IEL6ZVWmkO1bXQVjOozYSnzJGBffTz6 qIKzBZVQf7U8D8V3PGQNVIaEkSe13rogz5Y2qyo8CCrWeKF62jbrkzWJs0SYsSPHHZeO mus/4nD5Ks8Df7b31wA1xMpCprCUxnCp93h31L9jQTipkLd2bMbJEi8aQy0rhO96YglK vAKM5RJKIuLooNEOKsOOiRlyupuAgTTMtRpZ5qdBHwAe7kb4qX+7d4DOY8Ca1EnNhAAX ERNg== X-Gm-Message-State: AOAM531AYJdMPirMy5TVWYoy+tzSfNWCBctXKqiSjER5cZ+dG0tLiohQ xgPSOczlVL/rHdkTlJNL7g0= X-Received: by 2002:ac2:5a01:: with SMTP id q1mr11219181lfn.182.1595262185871; Mon, 20 Jul 2020 09:23:05 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-38-130.ip.moscow.rt.ru. [37.110.38.130]) by smtp.googlemail.com with ESMTPSA id a19sm925855lff.25.2020.07.20.09.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 09:23:05 -0700 (PDT) From: Denis Efremov To: Julia Lawall Cc: Denis Efremov , cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] coccinelle: api: filter out memdup_user definitions Date: Mon, 20 Jul 2020 19:22:16 +0300 Message-Id: <20200720162216.13248-4-efremov@linux.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200720162216.13248-1-efremov@linux.com> References: <20200720162216.13248-1-efremov@linux.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Don't match memdup_user/vmemdup_user. Signed-off-by: Denis Efremov --- scripts/coccinelle/api/memdup_user.cocci | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/coccinelle/api/memdup_user.cocci b/scripts/coccinelle/api/memdup_user.cocci index 60027e21c5e6..e01e95108405 100644 --- a/scripts/coccinelle/api/memdup_user.cocci +++ b/scripts/coccinelle/api/memdup_user.cocci @@ -15,12 +15,20 @@ virtual context virtual org virtual report +@initialize:python@ +@@ +filter = frozenset(['memdup_user', 'vmemdup_user']) + +def relevant(p): + return not (filter & {el.current_element for el in p}) + @depends on patch@ expression from,to,size; identifier l1,l2; +position p : script:python() { relevant(p) }; @@ -- to = \(kmalloc\|kzalloc\) +- to = \(kmalloc@p\|kzalloc@p\) - (size,\(GFP_KERNEL\|GFP_USER\| - \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN\)); + to = memdup_user(from,size); @@ -42,9 +50,10 @@ identifier l1,l2; @depends on patch@ expression from,to,size; identifier l1,l2; +position p : script:python() { relevant(p) }; @@ -- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\)); +- to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\)); + to = vmemdup_user(from,size); if ( - to==NULL @@ -63,7 +72,7 @@ identifier l1,l2; @r depends on !patch@ expression from,to,size; -position p; +position p : script:python() { relevant(p) }; statement S1,S2; @@ @@ -76,7 +85,7 @@ statement S1,S2; @rv depends on !patch@ expression from,to,size; -position p; +position p : script:python() { relevant(p) }; statement S1,S2; @@ -- 2.26.2