Received: by 10.223.176.5 with SMTP id f5csp2518183wra; Thu, 1 Feb 2018 01:41:38 -0800 (PST) X-Google-Smtp-Source: AH8x226zWMFTkz+ONOxydwW4ewzGqaxCkEj9/T7dtBMBuG9wWzrwqAWBJupR+VgYlVIPiy8UgVK9 X-Received: by 2002:a17:902:bd84:: with SMTP id q4-v6mr21958670pls.247.1517478098894; Thu, 01 Feb 2018 01:41:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517478098; cv=none; d=google.com; s=arc-20160816; b=Hc/4o6R2CSZVSDzf8XwCR+8OCRqFotxmYGgkjs37ADZSB7KoYcdctdmdVN4iGQ4uxE ZSw1q4Hk8oabrXWqQbZxyn+E8GjB75mvZzwNjpEnXijvsIOrBd+lrLOidSIohy/PGyHd D3MVH772VupvGVUp0oQlXTNeL0MzDY8FTXNfCibGLlPd7779S8AQ638bPN0ueNkSyGMX AwJc4ovZKV456Z8rAhL6Wuo2Sq3hJWiKDe90gOFVqPe8i8FYslCY+FHDX7/pmRUKXlGI NhANw6LRWNBijfhIYT7edpkDXG1lkx6ZzijN8gwsQ0rC1Loq7VD3fMSqbmUVQh+euvq9 56lA== 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 :arc-authentication-results; bh=dcKjGDev0r8jfdnX41ptYl/VOvirO8K9Tyg3gf92K00=; b=k8BJQiPrkbgMbabzuvdrpfPe0bhM7+HFk7hz0ej4bhYCtKCjXAp91IyvI4W6D4Ks3D pFCJHOkjVBmNyu2j9DvslCxLx70ISw7awm1+zs3JR56DeDzkc4pPlVrlrs9M7sSG9Swz 7j2Q86GIlaQcBRXuJMeKGzIafNnW/ghlGW967f2fO8l2d1dE2WAfOF3z1R54gHBubTAy Pvy0CGgybfy5GEPNJ+GHRfUGkL4GmsoRPHzpf7WFjrao10CLda38giFfQvfCQIbKTrTx 4SSQ6yrvhWbNuZ3HcjbCHd1C3XnP8zFSPtcmW8FfZTKKnaYPMDxc1lz+hSW5fL+mgrCR VKAQ== 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 b8-v6si1272762ple.359.2018.02.01.01.41.24; Thu, 01 Feb 2018 01:41:38 -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 S1751994AbeBAJku (ORCPT + 99 others); Thu, 1 Feb 2018 04:40:50 -0500 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:50943 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751520AbeBAJkp (ORCPT ); Thu, 1 Feb 2018 04:40:45 -0500 X-IronPort-AV: E=Sophos;i="5.46,443,1511823600"; d="scan'208";a="253233217" Received: from vaio-julia.rsr.lip6.fr ([132.227.76.33]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 01 Feb 2018 10:40:43 +0100 Date: Thu, 1 Feb 2018 10:40:40 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: SF Markus Elfring cc: cocci@systeme.lip6.fr, Gilles Muller , Himanshu Jha , Masahiro Yamada , Michal Marek , Nicolas Palix , LKML , kernel-janitors@vger.kernel.org Subject: Re: [PATCH] Coccinelle: zalloc-simple: Delete function "kmem_cache_alloc" from SmPL rules In-Reply-To: <6bee0e11-59ef-b7b1-886e-7abaa30887f2@users.sourceforge.net> Message-ID: References: <6bee0e11-59ef-b7b1-886e-7abaa30887f2@users.sourceforge.net> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) 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 On Thu, 1 Feb 2018, SF Markus Elfring wrote: > From: Markus Elfring > Date: Thu, 1 Feb 2018 10:20:47 +0100 > > The deletion for a call of the function "memset" depends on > the specification that a size determination is passed by > the expression "E1". > The function "kmem_cache_alloc" was specified despite of the technical > detail that this function does not get a parameter passed which would > correspond to such a size information. > > Thus remove it from the first two SmPL rules and omit the rule "r4". Nack. It should be supported by the size determined in another way. julia > Link: https://elixir.free-electrons.com/linux/v4.15/source/tools/testing/radix-tree/linux/slab.h#L14 > Link: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/tools/testing/radix-tree/linux/slab.h?id=f26e52e08ab8e56f528ac14aa7929b3477de5616#n14 > Fixes: 5e2d9da5b9ba350a4f13bd3b255be046bcf86465 ("Coccinelle: kzalloc-simple: Add all zero allocating functions") > Signed-off-by: Markus Elfring > --- > scripts/coccinelle/api/alloc/zalloc-simple.cocci | 41 +----------------------- > 1 file changed, 1 insertion(+), 40 deletions(-) > > diff --git a/scripts/coccinelle/api/alloc/zalloc-simple.cocci b/scripts/coccinelle/api/alloc/zalloc-simple.cocci > index 92b20913055f..3bee6cdd99ea 100644 > --- a/scripts/coccinelle/api/alloc/zalloc-simple.cocci > +++ b/scripts/coccinelle/api/alloc/zalloc-simple.cocci > @@ -34,7 +34,7 @@ statement S; > @@ > > * x = (T)\(kmalloc(E1, ...)\|vmalloc(E1)\|dma_alloc_coherent(...,E1,...)\| > - kmalloc_node(E1, ...)\|kmem_cache_alloc(...)\|kmem_alloc(E1, ...)\| > + kmalloc_node(E1, ...)\|kmem_alloc(E1, ...)\| > devm_kmalloc(...,E1,...)\|kvmalloc(E1, ...)\|pci_alloc_consistent(...,E1,...)\| > kvmalloc_node(E1,...)\); > if ((x==NULL) || ...) S > @@ -88,15 +88,6 @@ statement S; > - x = (T)kmalloc_node(E1,E2,E3); > + x = (T)kzalloc_node(E1,E2,E3); > | > -- x = kmem_cache_alloc(E3,E4); > -+ x = kmem_cache_zalloc(E3,E4); > -| > -- x = (T *)kmem_cache_alloc(E3,E4); > -+ x = kmem_cache_zalloc(E3,E4); > -| > -- x = (T)kmem_cache_alloc(E3,E4); > -+ x = (T)kmem_cache_zalloc(E3,E4); > -| > - x = kmem_alloc(E1,E2); > + x = kmem_zalloc(E1,E2); > | > @@ -268,36 +259,6 @@ x << r3.x; > msg="WARNING: kzalloc_node should be used for %s, instead of kmalloc_node/memset" % (x) > coccilib.report.print_report(p[0], msg) > > -//----------------------------------------------------------------- > -@r4 depends on org || report@ > -type T, T2; > -expression x; > -expression E1,E2,E3; > -statement S; > -position p; > -@@ > - > - x = (T)kmem_cache_alloc@p(E2,E3); > - if ((x==NULL) || ...) S > - memset((T2)x,0,E1); > - > -@script:python depends on org@ > -p << r4.p; > -x << r4.x; > -@@ > - > -msg="%s" % (x) > -msg_safe=msg.replace("[","@(").replace("]",")") > -coccilib.org.print_todo(p[0], msg_safe) > - > -@script:python depends on report@ > -p << r4.p; > -x << r4.x; > -@@ > - > -msg="WARNING: kmem_cache_zalloc should be used for %s, instead of kmem_cache_alloc/memset" % (x) > -coccilib.report.print_report(p[0], msg) > - > //----------------------------------------------------------------- > @r5 depends on org || report@ > type T, T2; > -- > 2.16.1 > > -- > To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html >