Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2381890rwb; Sun, 2 Oct 2022 22:45:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6lLcCTgg++Zpe39NiSuWi7csZH4lvFpkk5dv1VtnOoCCTUFMy2iMbTEI3fEMoKFhOtnr0j X-Received: by 2002:a17:902:d353:b0:178:8976:e78f with SMTP id l19-20020a170902d35300b001788976e78fmr20396705plk.68.1664775909891; Sun, 02 Oct 2022 22:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664775909; cv=none; d=google.com; s=arc-20160816; b=aBz4jBrDt66hj4fGSUATqibrSn2JaEOdMKw2206I2BpE6FNLFfmUtikBX8xjMFMkd8 8Nvl/ONvbS5UglaMiW+BmejhnQKybET/+QvpGxZv/RRLOX2ypRppJCgiewL4kxrByJsE 5/aDCyFs3XUJryxoOmGPGZqap2W7xlxmnrxFwJUQrOgyEqu5jEysol1iQspav5InBASM R4WNa0+4Y/tQUi/d5cGD3CeAQetEEltGtL5YFO+5wY3WeBGLL/nyR6LphWbJaj7TCjNL K/MCj4ugSclhWYRxbI+fazYyNyyjjLuTSIDcex4cuEWs92ycqjVK00b5+Ta3Q0tli4xu ucKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=gelhAHVsAEbkU1KjVUQe9/OkZPGNhdu+wjoGDfxpTYk=; b=momRY59tgBF8yvWi5FazkjIJnkkDceXNXgFkZ5Dt0piqHZYl5GhPuC9oLedZU+1cZm u9l4m7qYhU6L5Ax4DVAshNnex7JIptjyH89C6NT8dRv+5sOZ0P3QWSdUpRmwWbWRMJvD Xp+32FYWLEvGGNo/j5XLQQJPpUnK6LBOnpAMaxjof46RxC18hfOJvXFqG2AgTLCoGae5 4ZuTZf7M0GcBA3TaPITGLCxJwYHvWkfUC7/Uq6rustK/cHGvNVWIDrNbzCj0ChaXMV0m X6gw7Swvdd4vJO0d8JBs2etpqtYiPN5TRSuVz3mOeI2ak7q0CicUYFvdQJqXRxALZvsB NYew== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 9-20020a630a09000000b0041bb87776ebsi10042648pgk.352.2022.10.02.22.44.59; Sun, 02 Oct 2022 22:45:09 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229627AbiJCFjG convert rfc822-to-8bit (ORCPT + 99 others); Mon, 3 Oct 2022 01:39:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbiJCFjE (ORCPT ); Mon, 3 Oct 2022 01:39:04 -0400 Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C36CE326FF; Sun, 2 Oct 2022 22:39:03 -0700 (PDT) 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> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, SPF_NONE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 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-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 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?