From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 762CDC433F5 for ; Mon, 3 Oct 2022 05:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:Cc:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FEKINzH5zJKhw5dE67ONG/+f5rX9kxIQtqmLG0Vo5Cw=; b=QDTbKSKPjPNjXo BZuO6TpXG/igOvXsUZ039OpS9jWs219HQqIrkccd5oLBtYPZJHa32kcriy3mVT7cOt8tKMvP+ny8E YFICRbMbYiH+lXZZ0zx82+1PjRSmfZD2J4LixM6xO2ZGcQGw/x11fImIUsV8/CFRVAmhFgVbv6oo0 rkRvD1hv6Lnw+AnMnF6ERnaKhxkaOms9dffjGp1pu6C7OKY+wUlUFG4R3EJur1AQM+XUfqb4R72HX OqvY/TBvb5XSVt96tqfsB135JsrlugGCyNeBcczYnvezOyrN0zjtgJNJdESrh+PARA4v7eY6Q07/0 tSdUP0SMa4z1JZ8lJ+XQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofEAY-0042KG-0p; Mon, 03 Oct 2022 05:39:10 +0000 Received: from smtprelay0014.hostedemail.com ([216.40.44.14] helo=relay.hostedemail.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofEAU-0042Hu-G3 for linux-arm-kernel@lists.infradead.org; Mon, 03 Oct 2022 05:39:08 +0000 Received: from omf01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id DCB1E409F8; Mon, 3 Oct 2022 05:39:00 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf01.hostedemail.com (Postfix) with ESMTPA id A95C060009; Mon, 3 Oct 2022 05:38:52 +0000 (UTC) Message-ID: <04ade5f54bd3dc658cb8606c98b0b1fe34a97383.camel@perches.com> Subject: Re: new checkpatch flexible array test ? (was Re: [PATCH v4 12/14] gunyah: rsc_mgr: Add RPC for console services) From: Joe Perches To: Greg Kroah-Hartman , "Gustavo A. R. Silva" 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 Date: Sun, 02 Oct 2022 22:38:51 -0700 In-Reply-To: References: <20220928195633.2348848-1-quic_eberman@quicinc.com> <20220928195633.2348848-13-quic_eberman@quicinc.com> User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Stat-Signature: any5n6dxybnur6i78t7xb6k1yayxcqqa X-Rspamd-Server: rspamout02 X-Rspamd-Queue-Id: A95C060009 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1/g7GhkL1qx20CJKVVk/r/b4D3cncpPwyQ= X-HE-Tag: 1664775532-285486 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221002_223906_612541_021E971B X-CRM114-Status: GOOD ( 23.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 2022-10-03 at 07:29 +0200, Greg Kroah-Hartman wrote: > 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: > > --- [] > > diff --git 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*$/) { This should actually be: $lines[$linenr] =~ /^[\+ ]\}(?:\s*__\w+\s*(?:$balanced_parens)?)*\s*;\s*$/) { as it was missing a * for uses like int foo[0]; } __packed __aligned(4); and uses without any attribute at all > > + 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? _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel