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 1E3FBC433FE for ; Mon, 3 Oct 2022 05:30:31 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=swpID5fn+k5XsXkzeFPZxECkCtPa3ofkem9Rb0CaoEw=; b=TYnAc3IvtN9wuu dNGByUfqY5TgcuxegKMDuo+3eSYjRK7DAS5QvfPipkfcRjgpsmAJ9qb+vYj4GF5c/69Tw8z7SoGlt o1FE0WizwDdSM75PrzNvvVDtLeRYu9eMeM6Llx3WbQYAgY5nS/u5fZghK1AB3YS2a44790IxvW46u UAqYdxUN84N+ac1hVrgfahk8rcN6WaQJoLHr+m9cwKYLHYPjSJ9bC3r0BmUxGKYyIhQiRzoYgYjFn saLZlYnCK8WwlS1iJtHH2ioU5xsM7fcf2xlAoV4C3qiqec3hv3DN9yNyeI561Dxt49ONjsGUmoXYl JZ3j5QHBpMbAzsmHNgJA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofE19-0040QL-2o; Mon, 03 Oct 2022 05:29:27 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofE15-0040Pg-VV for linux-arm-kernel@lists.infradead.org; Mon, 03 Oct 2022 05:29:25 +0000 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 997A3B80DB9; 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-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221002_222924_323889_D97C482F X-CRM114-Status: GOOD ( 25.23 ) 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 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel