Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2243189rwb; Sun, 2 Oct 2022 19:07:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4fBDr5TsaMA096e7x8VW0FE/42uE4K1EMC7QDrepzUdIYZUcWCrUP+8eF0tYXpadGt7pgJ X-Received: by 2002:a17:903:22c9:b0:17a:62b:80e9 with SMTP id y9-20020a17090322c900b0017a062b80e9mr19928046plg.48.1664762850425; Sun, 02 Oct 2022 19:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664762850; cv=none; d=google.com; s=arc-20160816; b=FffOCwnhBS1Qx6+ys51K+nioC3h8LI22st2XywqtMV7wdhLuH3zfP+2dDlx8LEI9mN ShV9fmFgUV4nAzGirGVCyj8BEnaXgO7EiEq+zzDrc/WXkN9JpsC2Jv2nW/qywmrGBgJM 83ZZahEm1nh2xYyA+qTg+nghfavb4ChyOZ58Y33Xhu1ygZLnv2ZiDU2i9s62BUQDlszy wBl5zLAgzVtpsdvD+NFMAMBWh1JU88K6LzcH3bw46aBrxSnttbZEVPdamwe/yucDfmD3 OIkO3Ed1cBrKe9L8sWFqUdFDV5BY4IQES394ycACno3cMiwXTtT4MVzbpKidv/wejtCJ 3i2A== 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=5RbYDPwGXldu+Nuy9iIWa7aj9ZGLRl2Fi4gKBVdy8U8=; b=vUATW5MpfTYXfcqkbRhnHwNVA5aaWTCRnhQEAA4gJixQHkvzhIo+OvPKaV/LEj1bq2 wVzRcXHn5nc+UKCYG8m2O+CDovYXaBLS/mesn+KvdRZs/PE8yomKoKykn3HGMbwbBX4+ Br3G1g3FNVOSM/BFMp4hqSnQjUSbdh/tbeppSyd52zHOVVvhoYwnVhM+qojtPQueAl+n J5IqAPm1+yQoUE2wOFl7Ze5bXEX4wp977mC44oIvne12iynbw/7M70hWJw6qgkXGs8N0 cTaiAEGLBDYtUibdvqZYFOzpDTM5zRu/j9L9HigcAFAAFPsPvWn7a+lQKyFdEyYrkH+E oKWA== 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 e15-20020a63544f000000b0041ce0347bc3si9125942pgm.354.2022.10.02.19.07.18; Sun, 02 Oct 2022 19:07:30 -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 S229484AbiJCBqp convert rfc822-to-8bit (ORCPT + 99 others); Sun, 2 Oct 2022 21:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229458AbiJCBqn (ORCPT ); Sun, 2 Oct 2022 21:46:43 -0400 Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DBA127CC4; Sun, 2 Oct 2022 18:46:41 -0700 (PDT) Received: from omf02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 71710C0802; Mon, 3 Oct 2022 01:46:38 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA id A5C348000E; Mon, 3 Oct 2022 01:46:31 +0000 (UTC) Message-ID: Subject: 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 , Elliot Berman , Andrew Morton Cc: 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 18:46:30 -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-Stat-Signature: s8bxywehf4i6ap8qz4d4zh7cgy8f5nng X-Rspamd-Server: rspamout05 X-Rspamd-Queue-Id: A5C348000E X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,SPF_HELO_PASS,SPF_NONE,UNPARSEABLE_RELAY autolearn=no autolearn_force=no version=3.4.6 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX1+OfeghBDJYxV12c+mletSZVAMPeQeBrtw= X-HE-Tag: 1664761591-583478 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 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*$/ &&