Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2410103rwb; Sun, 2 Oct 2022 23:24:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5IPM8NSiyD1u1lEZdnuAf5hkcokWkS75i5Ij5tAVz0KMl9mGO8G29nMcb8RhAMQHrlCmSE X-Received: by 2002:a05:6402:3552:b0:451:2037:639e with SMTP id f18-20020a056402355200b004512037639emr17549801edd.136.1664778264488; Sun, 02 Oct 2022 23:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664778264; cv=none; d=google.com; s=arc-20160816; b=E+iudYKORjX+lc0TJcgDtvvAQ1sRHfLwaIUT/f9nmrK68/uUgV+O2vYXC2qCQwgZ7X 8UuPvbsN/N+0NPQO3aMQqdqT/OGysfj3cb0xxAQQwbFKwHPZv7c/LwbVt1jSjvmDn+8X Nlrw7NlT1A2br7fMF9J/sOPumIODTPkmpRJ5xaWSq4rXQASjUdvmgnsp+sAxyv46E2if IohHWXXOQ2T7tgS01pMdRymFQ9lLmYxNWGVbzlcq9F6IvxyUwE4cPClBPN589ZsKkTzA ad8hGDASLGzbsPFKsoIFdNoC9aztO4XSVrYGSt5MsYNpt/DOxnO28Op5dQ0REnh4v1LC bLWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=zPwou5MViQBn0kOZan5QgD9vQgEGLm4OhaFZ1yG3pC8=; b=qza2Rbrw/jn0CaOlf6/g+1RrenXCbktFOtu3HPnVRdGP2NwBjR4OIj/BYRGt76bjSr WvwUv8HinyoM/XfBG8qOO/3+Y7sAGRpKiej69a/F86TIEP9/hLgW732J1fTAyDmXK+vM VgrzWHBWdqRqxK8KbhAAlFJpb1ko3J7yyy1r/JrgKoVN9dwFkx3za+0+bZRax2r28YM9 gjCEMZnAdeDGuqG5K4abQ1/Hure9Tfau5chnRGq7WbX1X8Hg3GlTIAeRsvLmtCEBSiaG Al6oTV7HVNWPx4JfD64wwRBvd0sddComegyCPLHBVNVVMthz4LAHg3bg16YJo0IN8WDm 4rvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OpgvaA6I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qk37-20020a1709077fa500b00783ca4d1c74si7229893ejc.520.2022.10.02.23.23.58; Sun, 02 Oct 2022 23:24:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OpgvaA6I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229605AbiJCF30 (ORCPT + 99 others); Mon, 3 Oct 2022 01:29:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbiJCF3Y (ORCPT ); Mon, 3 Oct 2022 01:29:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 188C92E6BB; Sun, 2 Oct 2022 22:29:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B0493B80DC8; Mon, 3 Oct 2022 05:29:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2464C433D6; Mon, 3 Oct 2022 05:29:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664774960; bh=joD1y2rfEII9cd3jqH3Jj7paIkXHLkM1SQfNeRd7EVI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OpgvaA6IsJgmIJU3f0HB/azNohN8L3Y/rJJk3QT0Loo7iC6cy3pdXuX9nZ9GMl1I3 0WlmzUkCwNi1wNsMEGDq/HJlrxsLswQ7g9xMXLP8mU4vgpaIVmFSVvw8aiwNA8OmQV p2NnBCKF+m4jSruAsiP1042QnY0qk+j889FbBgrQ= Date: Mon, 3 Oct 2022 07:29:57 +0200 From: Greg Kroah-Hartman To: "Gustavo A. R. Silva" , Joe Perches Cc: Elliot Berman , Andrew Morton , Bjorn Andersson , Murali Nalajala , Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Andy Gross , Dmitry Baryshkov , Jassi Brar , linux-arm-kernel@lists.infradead.org, Mark Rutland , Lorenzo Pieralisi , Sudeep Holla , Marc Zyngier , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , Will Deacon , Catalin Marinas , Arnd Bergmann , devicetree@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: new checkpatch flexible array test ? (was Re: [PATCH v4 12/14] gunyah: rsc_mgr: Add RPC for console services) Message-ID: References: <20220928195633.2348848-1-quic_eberman@quicinc.com> <20220928195633.2348848-13-quic_eberman@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 02, 2022 at 06:46:30PM -0700, Joe Perches wrote: > On Fri, 2022-09-30 at 14:22 +0200, Greg Kroah-Hartman wrote: > > On Wed, Sep 28, 2022 at 12:56:31PM -0700, Elliot Berman wrote: > > > Gunyah resource manager defines a simple API for virtual machine log > > > sharing with the console service. > [] > > > diff --git a/include/linux/gunyah_rsc_mgr.h b/include/linux/gunyah_rsc_mgr.h > [] > > > +struct gh_rm_notif_vm_console_chars { > > > + u16 vmid; > > > + u16 num_bytes; > > > + u8 bytes[0]; > > > > Please do not use [0] for new structures, otherwise we will just have to > > fix them up again as we are trying to get rid of all of these from the > > kernel. Just use "bytes[];" instead. > > Maybe a checkpatch addition like: > --- > scripts/checkpatch.pl | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 2737e4ced5745..187ed84c1f80a 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -3948,6 +3948,17 @@ sub process { > } > } > > +# check for zero length array declarations in likely structs > + if ($line =~ /^\+\t($Declare\s*$Ident)\s*\[\s*0\s*\]\s*;\s*$/ && > + defined $lines[$linenr] && > + $lines[$linenr] =~ /^[\+ ]\}\s*(?:__\w+\s*(?:$balanced_parens)?)\s*;\s*$/) { > + if (WARN("FLEXIBLE_ARRAY_ZERO", > + "Prefer flexible length array declarations with [] over [0]\n" . $herecurr) && > + $fix) { > + $fixed[$fixlinenr] =~ s/\[\s*0\s*\]/[]/; > + } > + } > + > # check for multiple consecutive blank lines > if ($prevline =~ /^[\+ ]\s*$/ && > $line =~ /^\+\s*$/ && This is a question for Gustavo, who did all the work here. Gustavo, does the above checkpatch change look good to you? thanks, greg k-h