Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2278797ybh; Fri, 17 Jul 2020 13:57:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsCG3NuMWOkyd5JU0Sjl1dA8VruKsXNGVK9hjYT7GwdGn+rjpz25Ut7twYB7AdPMSkMk3/ X-Received: by 2002:a05:6402:742:: with SMTP id p2mr10654625edy.135.1595019479457; Fri, 17 Jul 2020 13:57:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595019479; cv=none; d=google.com; s=arc-20160816; b=p7qIdh5/0elND8VsHroMr43YIglkUDDW+lsDiR1wt16LbBoTzfp76PXw7x/f4CEOGI jQaXZdZpydqxoovNL45a9hLfKq86OBjCnpItm/hmMel5OXadeZUwErl2NIiUp95fEU+H G0CeyFQZEWBD00yGZVbHWOMkAb8WU+V8wmL97gOu4vVRqPebh8p3r7TwrPIPxBKUes41 O+9EG2GAC3hn77u2MPVwBbW8t088lUn0k+rHLqWKCws1KpQXxZT/YeMBBw3vAUdUQlVL wYnHQC6vKj4Cd/PjReUIZtU4sCGrMsoEm9CsBoI4urG1yWMo0XLG+qZElN1ZaTqg9MO/ 6/fQ== 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=pBAfuPpu3oBXPL/4VwpbC8RkHSf+20UJJNYXmX+nBls=; b=ag0cDAYpBrd/uGovXKHDtSx+gpPgBjHRmqKiIUtFhudkhbPHhXJwub+gZb2J1Wkq2U 2IIoP2rGknmirtOAZJPHsa4EfKkOk1Kkh5kfElh29YtLcccMylFSWSOMOroqqy9wE6Kq 0KyMXGHfqSbkd8/ym015BrGrupwMNwcDaTGrjePeyJ/B866x8nqtowzPP8tYPWzQ2e2p 4/ZdpXJfy5/AyoP5k15bcOj1gQ9yahEu779AmXc0sH/yS0wQBywZx1G0m2A/0cxIyfOh TNy0P3WQSh10kq5FEruXa4w06NufBDHAzeCE6g1FodlF3l4r7gCKPg2YDIYWhdV8aXGX xLVw== 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 i25si3629058ejf.697.2020.07.17.13.57.36; Fri, 17 Jul 2020 13:57:59 -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 S1726793AbgGQU4H (ORCPT + 99 others); Fri, 17 Jul 2020 16:56:07 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:50613 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726393AbgGQU4G (ORCPT ); Fri, 17 Jul 2020 16:56:06 -0400 X-IronPort-AV: E=Sophos;i="5.75,364,1589234400"; d="scan'208";a="354705512" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2020 22:56:05 +0200 Date: Fri, 17 Jul 2020 22:56:05 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Denis Efremov cc: linux-kernel@vger.kernel.org, cocci@systeme.lip6.fr Subject: Re: [Cocci] [PATCH v2 1/4] coccinelle: api: extend memdup_user transformation with GFP_USER In-Reply-To: <20200608150038.223747-2-efremov@linux.com> Message-ID: References: <20200608150038.223747-1-efremov@linux.com> <20200608150038.223747-2-efremov@linux.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) 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 Mon, 8 Jun 2020, Denis Efremov wrote: > Match GFP_USER and optional __GFP_NOWARN allocations with > memdup_user.cocci rule. > Commit 6c2c97a24f09 ("memdup_user(): switch to GFP_USER") switched > memdup_user() from GFP_KERNEL to GFP_USER. In almost all cases it > is still a good idea to recommend memdup_user() for GFP_KERNEL > allocations. The motivation behind altering memdup_user() to GFP_USER: > https://lkml.org/lkml/2018/1/6/333 > > Signed-off-by: Denis Efremov Applied. > --- > scripts/coccinelle/api/memdup_user.cocci | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/scripts/coccinelle/api/memdup_user.cocci b/scripts/coccinelle/api/memdup_user.cocci > index c809ab10bbce..cadcc2e87881 100644 > --- a/scripts/coccinelle/api/memdup_user.cocci > +++ b/scripts/coccinelle/api/memdup_user.cocci > @@ -20,7 +20,9 @@ expression from,to,size; > identifier l1,l2; > @@ > > -- to = \(kmalloc\|kzalloc\)(size,GFP_KERNEL); > +- to = \(kmalloc\|kzalloc\) > + (size,\(GFP_KERNEL\|GFP_USER\| > + \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN\)); > + to = memdup_user(from,size); > if ( > - to==NULL > @@ -43,7 +45,9 @@ position p; > statement S1,S2; > @@ > > -* to = \(kmalloc@p\|kzalloc@p\)(size,GFP_KERNEL); > +* to = \(kmalloc@p\|kzalloc@p\) > + (size,\(GFP_KERNEL\|GFP_USER\| > + \(GFP_KERNEL\|GFP_USER\)|__GFP_NOWARN\)); > if (to==NULL || ...) S1 > if (copy_from_user(to, from, size) != 0) > S2 > -- > 2.26.2 > > _______________________________________________ > Cocci mailing list > Cocci@systeme.lip6.fr > https://systeme.lip6.fr/mailman/listinfo/cocci >