Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp213973pxf; Wed, 24 Mar 2021 03:24:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKGv9o6++C/vs+OWKIEjj2KDLr3TlsKkPkjCiyv5ofaHdMjp+NL/JZ1QzUTO7Ns5WxBbid X-Received: by 2002:a17:906:7f01:: with SMTP id d1mr2930841ejr.136.1616581469323; Wed, 24 Mar 2021 03:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616581469; cv=none; d=google.com; s=arc-20160816; b=e05m2+P6kuflwHak+uRaOUBpX0GaVAl4eyTdAI2qKKPAezbZfh9BIVB0r1NmJA20l0 bZYOENpTuOkk9U9Y3g2Axvvvf36wjz6iFs2vLLZavpYkGZl2wjdTB5LCVlGSISLkI2xe qmqB9VSwEqC6RUQHaZazdoCzoT02cPS1FQRnnetQt1CJphCYp5v5g5vKKk5lVYimNvzD 213T2SGlb17D4JLedaTMJTwHkmEPC4Yc22yuExIoaB8NjfYNWQCH68qcRMUb6eSH/tZz BlpV0HqUAHmoEZ83vyhAE5FdvQFgt3wqaUXnBkZLRMtGAr0kb6+nueVm7k/Rf7qGjeDe 2EKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=FWlu5K9gEFDGnnILojK8GPw7KEusUZckkU+/bB/ppV0=; b=NrSMTK02zkuQsADjIzQEZ8xTNAab2wfepHGG3jX1oEjF/FfSujdnNdIDYf+9v8BxX0 AVhSsHiKgO+UvgNLFo0wvRclwD4o2tCiiLrzmQhgvoVZinwrf4ZmIOWX2GbIIMk1iTx3 GRBh6btHt9/61GAqwnRoCI6FJSDxpys+QgyZ11JPpAfNmKK80ja7unVQYJWOo4k22AdA pi7xTdvoB08C95+0sVZhuWRIyX9Zzhhnbf2oySFP7J/KMEB2nqXo7dj1CtVTzgZ7kqNl Dga3NzV6HsApYnUaQXDAO/lMBSLoyX7Qw+OrmwtQZOTAe7fqB7u8HYHTByfMt0Q0FPq2 mH+A== 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 r21si1333337ejx.301.2021.03.24.03.24.05; Wed, 24 Mar 2021 03:24:29 -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 S230316AbhCXHn3 (ORCPT + 99 others); Wed, 24 Mar 2021 03:43:29 -0400 Received: from mail-lj1-f170.google.com ([209.85.208.170]:40736 "EHLO mail-lj1-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230104AbhCXHnG (ORCPT ); Wed, 24 Mar 2021 03:43:06 -0400 Received: by mail-lj1-f170.google.com with SMTP id u10so28987114lju.7 for ; Wed, 24 Mar 2021 00:43:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=FWlu5K9gEFDGnnILojK8GPw7KEusUZckkU+/bB/ppV0=; b=mmp12Q6BdZj6QnhVDppl5IpUHKUETUjXjydcb/8W+2pK/78NNbH7lea31BBNYt3OjN 2CTzfQKSfSkc1GN0z8RBepjf+bA+gE3wqURG3u46OgTvGz/ZddVZ9qRhD1BJs0yk9En2 EWwHxYWWVcksCVi1UfKZ/ZBQvDQ/FENUjjvYNiPcygO7Pt1/KoowxkbZuStgdENVXY6i IrdFnc54kOffQxjxsJwD89FTA9gGowW3bFCXiyw4B2gCz2KjLcMDC2GRbMwC5aXotLKL zK+QE0jxGv6Z8sErZFkMKIIz4e1lQxFUy/iZbQlGrtzKVzFQ4cdTmLXZyK6ayZ7lSBsD xYIQ== X-Gm-Message-State: AOAM530Qvrcmcn9Wym1lE+iUEUBN8Nol02oG7iCZYhjSzy1jHg66SLWy 3QbsbTmaXrYNCtuXjZyp2qYzfR1n8x1OpQ== X-Received: by 2002:a05:651c:ca:: with SMTP id 10mr1252808ljr.63.1616571784781; Wed, 24 Mar 2021 00:43:04 -0700 (PDT) Received: from [10.68.32.192] (broadband-188-32-236-56.ip.moscow.rt.ru. [188.32.236.56]) by smtp.gmail.com with ESMTPSA id p10sm145901lfo.293.2021.03.24.00.43.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 Mar 2021 00:43:04 -0700 (PDT) Subject: Re: [PATCH] coccinelle: misc: restrict patch mode in flexible_array.cocci To: Julia Lawall Cc: cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org References: <20210308191215.1362498-1-efremov@linux.com> From: Denis Efremov Message-ID: <212e0bf3-0807-e2f1-a6fc-23f9e03906b2@linux.com> Date: Wed, 24 Mar 2021 10:43:03 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210308191215.1362498-1-efremov@linux.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ping? On 3/8/21 10:12 PM, Denis Efremov wrote: > Skip patches generation for structs/unions with a single field. > Changing a zero-length array to a flexible array member in a struct > with no named members breaks the compilation. However, reporting > such cases is still valuable, e.g. commit 637464c59e0b > ("ACPI: NFIT: Fix flexible_array.cocci warnings"). > > Signed-off-by: Denis Efremov > --- > scripts/coccinelle/misc/flexible_array.cocci | 23 ++++++++++++++++++-- > 1 file changed, 21 insertions(+), 2 deletions(-) > > diff --git a/scripts/coccinelle/misc/flexible_array.cocci b/scripts/coccinelle/misc/flexible_array.cocci > index 947fbaff82a9..f427fd68ed2d 100644 > --- a/scripts/coccinelle/misc/flexible_array.cocci > +++ b/scripts/coccinelle/misc/flexible_array.cocci > @@ -51,21 +51,40 @@ position p : script:python() { relevant(p) }; > }; > ) > > +@only_field depends on patch@ > +identifier name, array; > +type T; > +position q; > +@@ > + > +( > + struct name {@q > + T array[0]; > + }; > +| > + struct {@q > + T array[0]; > + }; > +) > + > @depends on patch@ > identifier name, array; > type T; > position p : script:python() { relevant(p) }; > +// position @q with rule "only_field" simplifies > +// handling of bitfields, arrays, etc. > +position q != only_field.q; > @@ > > ( > - struct name { > + struct name {@q > ... > T array@p[ > - 0 > ]; > }; > | > - struct { > + struct {@q > ... > T array@p[ > - 0 >