Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp273987pxk; Wed, 2 Sep 2020 00:26:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv/mUJLpzHMUN3380bThQ1oOVkxNYDDi8YwBrkdeBNUdDDcEZmFzxIxTVOOKyarfSaO1My X-Received: by 2002:a17:906:b74a:: with SMTP id fx10mr4893333ejb.232.1599031561197; Wed, 02 Sep 2020 00:26:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599031561; cv=none; d=google.com; s=arc-20160816; b=y2jKObfZZOT0lhnwAFfYKUOZprzqWVFBBzSHO2hxxnkdu4WuaAs9ZafKQ3gzKR9u+m w50UbNkMnxuvMZYinANulF58XXkct9rI9F8VmepZMDJPUBl6TfLBdthVnnQ+QiPH70IS hlOMljSydBTj/E3sDNiTd/jibRXS5mRsRNYvHYOycTpY7x0okEGo6urvHTaOWAAjPoIR K4oJ4XbprTa8d0uVHVABdDhQfbI7o0tjh5bn2BtNRRFcjoRb6NCfLozMLayyZWYHvd1G jDr3W/5ApoBSdn1f9B5Rp9QXX7IRaoYAU6fmNx83y3cFzh+HPQ9lW/QXuJGkWGgTydPR 51qQ== 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=trcntirH23+3+CeU2A8I8fy8aJgz/ZYRkQkWH6zYOfo=; b=pZq3KfBBWH1qc6zidsb3uQum12NiTOh0G69QPMHwITUhPABM7LS1wfQyAALx9QM0Rs YuBz/U8Flcsq3wD3d8ua+j0uukEwGiP2AFKtRZFFx+jRwcM5pDSMNYWrv+cFO76qCRUs V4wYwkA8eRUS3StRe2Ioqdc8N2SJ43Pp2txmN1yOMHF9k/MD0ZOBAv3Nb0Oe8UMf+n2X ouQpRsGSuyPZ7u4rqY7yRRsG5fP+/qG0BOGFYh3g5ViFedSIofqs3C4oY2DifT5eFbEa UfRyyhsliwtFtj8LAVekSzYunNEwiPgKSHAiuGaEGiidWgY6DiUxCQeU+p85/7UJpodW 2jtQ== 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 t19si2021798ejb.646.2020.09.02.00.25.38; Wed, 02 Sep 2020 00:26:01 -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 S1727030AbgIBHYE (ORCPT + 99 others); Wed, 2 Sep 2020 03:24:04 -0400 Received: from mail2-relais-roc.national.inria.fr ([192.134.164.83]:16036 "EHLO mail2-relais-roc.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbgIBHYD (ORCPT ); Wed, 2 Sep 2020 03:24:03 -0400 X-IronPort-AV: E=Sophos;i="5.76,359,1592863200"; d="scan'208";a="465666314" 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; 02 Sep 2020 09:24:00 +0200 Date: Wed, 2 Sep 2020 09:24:00 +0200 (CEST) From: Julia Lawall X-X-Sender: jll@hadrien To: Markus Elfring cc: Denis Efremov , Coccinelle , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Gilles Muller , "Gustavo A. R. Silva" , Julia Lawall , Kees Cook , Masahiro Yamada , Michal Marek , Nicolas Palix Subject: Re: [PATCH] coccinelle: ifnullfree: add vfree(), kvfree*() functions In-Reply-To: <99e82f65-e02e-988a-4e78-4d438ff8e28e@web.de> Message-ID: References: <99e82f65-e02e-988a-4e78-4d438ff8e28e@web.de> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1962328576-1599031440=:2528" 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-1962328576-1599031440=:2528 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT On Wed, 2 Sep 2020, Markus Elfring wrote: > … > > +++ b/scripts/coccinelle/free/ifnullfree.cocci > > @@ -20,8 +20,14 @@ expression E; > > - if (E != NULL) > > ( > > kfree(E); > > +| > > + kvfree(E); > > | > > kfree_sensitive(E); > > +| > > + kvfree_sensitive(E, ...); > > +| > > + vfree(E); > > | > > debugfs_remove(E); > > | > > Would you ever get into the development mood to move the source code search > specification “(E);” out of the SmPL disjunction (as it happened for the rule “r”)? > > > > @@ -42,9 +48,10 @@ position p; > > @@ > > > > * if (E != NULL) > > -* \(kfree@p\|kfree_sensitive@p\|debugfs_remove@p\|debugfs_remove_recursive@p\| > > +* \(kfree@p\|kvfree@p\|kfree_sensitive@p\|kvfree_sensitive@p\|vfree@p\| > > +* debugfs_remove@p\|debugfs_remove_recursive@p\| > > * usb_free_urb@p\|kmem_cache_destroy@p\|mempool_destroy@p\| > > -* dma_pool_destroy@p\)(E); > > +* dma_pool_destroy@p\)(E, ...); > … > > How do you think about to attach the position variable to the opening parenthesis > instead of each function name? > > +* dma_pool_destroy\)(@p E, ...); While it probably impacts few people, this is a really bad idea for org mode, because org mode colors the thing that the position variable is attached to. Having the ( colored would not be very visible. But even for report mode, this is probably not a good idea for the rare case where the function name and the argument list are on different lines. julia > > > Would the number of function call parameters influence such SmPL code any more? > > Regards, > Markus > --8323329-1962328576-1599031440=:2528--