Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp586447ybh; Tue, 21 Jul 2020 02:59:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8rRCxQWENnqUSmf2M21JXGCn/3r67dbde/M9/tmYyzFU02RGgE1oe8CYn/i4V3RO6HSGO X-Received: by 2002:aa7:d8ca:: with SMTP id k10mr25327663eds.108.1595325585910; Tue, 21 Jul 2020 02:59:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595325585; cv=none; d=google.com; s=arc-20160816; b=FOwrvtkgdF/sm3uN2aG5tsXQWkIuOF6GmPxu8aVlQk5P50enxcFXijGFETA+kxWUyU 1F+A2PhJ4+GC7QkXOiYSDssWXAeTzdgMSEnsyjt3kzBcNOfAhfE19yWtV5siEUWWrjtY oAQGauvH0T4zzkJF6CM3vq+C5uCs4oEMVbKlNLKbjaELQpCLlrgUQJilhFlEkyh/LcLO h16K/HMYMiBhJi/Vgvjb8vzJGTqJiGCbqfKY3D550SI+V/u5rovMDSRe1RQ0IRhDH+K2 iDkHKdrMr6I0g9wlXWJXZTAl5L50GBNgRSDVzfQwV+7uydLDNTkMmsssRjyw9kgg9SzN 5SnA== 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=QUATrJwAD1Tibrl6RnbcPo/1rGA9pY4Zw8NJhJMtUd4=; b=SpuU5VLFIjipR1MkUrjIeDOzKw2W3U/iEu872QkAl/uqLAwbPwnCMgTbloPbUOWWWh LBpUeBDXERtXes6egypy6WZBB2BQePUvWzouSYsKIIsKwOuBTkCigXV28mlGKn4RxR/W OsJsDZW5dTQtJSUUgcFArzeWGbESFQRidp6EICX0OOcXCWlb/VUKi8dphbp2prXeL4Te mS4hkV1R1FQwsWn9xIVcIQTlPBw8PeD98HVWs5pBHJxzMMZ1ltj0lx82vDhkCuL0kIxc fa34VYYBddlA3GvvW8xFGrtCme9kSsUhLwUD/PBYarKbZktHn3+qKR1TCKGpoFVgHLWk nADA== 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 o13si10488187ejb.166.2020.07.21.02.59.23; Tue, 21 Jul 2020 02:59:45 -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 S1729044AbgGUJ66 (ORCPT + 99 others); Tue, 21 Jul 2020 05:58:58 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:25483 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726415AbgGUJ65 (ORCPT ); Tue, 21 Jul 2020 05:58:57 -0400 X-IronPort-AV: E=Sophos;i="5.75,378,1589234400"; d="scan'208";a="460637932" Received: from abo-173-121-68.mrs.modulonet.fr (HELO hadrien) ([85.68.121.173]) by mail2-relais-roc.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jul 2020 11:58:55 +0200 Date: Tue, 21 Jul 2020 11:58:55 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Markus Elfring cc: Denis Efremov , Coccinelle , Gilles Muller , Masahiro Yamada , Michal Marek , Nicolas Palix , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH v3 2/3] coccinelle: api: extend memdup_user rule with vmemdup_user() In-Reply-To: Message-ID: References: User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-577759684-1595325535=:2487" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-577759684-1595325535=:2487 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Tue, 21 Jul 2020, Markus Elfring wrote: > … > > +++ b/scripts/coccinelle/api/memdup_user.cocci > > @@ -39,6 +39,28 @@ … > … > > +@depends on patch@ > > +expression from,to,size; > > +identifier l1,l2; > > +@@ > > + > > +- to = \(kvmalloc\|kvzalloc\)(size,\(GFP_KERNEL\|GFP_USER\)); > > ++ to = vmemdup_user(from,size); > > I propose to combine the desired adjustment with the previous SmPL rule > by using another disjunction. > > > > +@rv depends on !patch@ > > +expression from,to,size; > > +position p; > > +statement S1,S2; > > +@@ > > + > > +* to = \(kvmalloc@p\|kvzalloc@p\)(size,\(GFP_KERNEL\|GFP_USER\)); > > + if (to==NULL || ...) S1 > > + if (copy_from_user(to, from, size) != 0) > > + S2 > > * Can it be helpful to omit the SmPL asterisk functionality from > the operation modes “org” and “report”? > > * Should the operation mode “context” work without an extra position metavariable? This is fine as is in all three aspects. julia --8323329-577759684-1595325535=:2487--