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 smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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 54E19C001DE for ; Mon, 31 Jul 2023 07:38:10 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D6E1960A87; Mon, 31 Jul 2023 07:38:09 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D6E1960A87 Authentication-Results: smtp3.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=F+cMlWCZ X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H5bd8fCwe0KH; Mon, 31 Jul 2023 07:38:09 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp3.osuosl.org (Postfix) with ESMTPS id D2AB260A6A; Mon, 31 Jul 2023 07:38:08 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org D2AB260A6A Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B8CC2C0072; Mon, 31 Jul 2023 07:38:08 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 938F8C0032 for ; Mon, 31 Jul 2023 07:38:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 6318E818D4 for ; Mon, 31 Jul 2023 07:38:07 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6318E818D4 Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=F+cMlWCZ X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id COcv6IBNArqq for ; Mon, 31 Jul 2023 07:38:06 +0000 (UTC) Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by smtp1.osuosl.org (Postfix) with ESMTPS id 86996818E6 for ; Mon, 31 Jul 2023 07:38:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 86996818E6 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BBC1260F3C; Mon, 31 Jul 2023 07:38:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1945C433C8; Mon, 31 Jul 2023 07:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690789085; bh=2irsA3UR2NHCKzIxBwtohzjleSszhcLRIjmgEyuaMck=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F+cMlWCZ9AnK1U1TT0BCCvsTMMBUzz1S2KeRJk2jWn/BE+hSueutMV6RLeObOyFCG 3fkxj/VInSwsSwSQPjrwAErNehMCDiSLG1hRFFsPDVIeBkwz5CMEVNACWLOJlKRFxE xkD6P96uG/i5flDLGsD+Ei/YNH18ZofEVtWzxcopptzbg14V0m6kyjCNuUnghCXRug sWPqCNVmoaHtL7B+J0HAixmmcIyGOb71k0/bdITmtqjRYrusoNM6HrB2fcxudfglRs up0B5qcxpaOfXlIT4PR61CwxRTjTQWR1KJdDQmYZUqubOaXAFibERM7pQ6QlA/u556 /Q0apdTy+TjVg== Date: Mon, 31 Jul 2023 10:38:01 +0300 From: Leon Romanovsky To: Atul Raut Subject: Re: [PATCH] net/macmace: Replace zero-length array with DECLARE_FLEX_ARRAY() helper Message-ID: <20230731073801.GA87829@unreal> References: <20230730231442.15003-1-rauji.raut@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230730231442.15003-1-rauji.raut@gmail.com> Cc: netdev@vger.kernel.org, avem@davemloft.net, rafal@milecki.pl, kuba@kernel.org, pabeni@redhat.com, linux-kernel-mentees@lists.linuxfoundation.org X-BeenThere: linux-kernel-mentees@lists.linuxfoundation.org X-Mailman-Version: 2.1.15 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 Errors-To: linux-kernel-mentees-bounces@lists.linuxfoundation.org Sender: "Linux-kernel-mentees" On Sun, Jul 30, 2023 at 04:14:42PM -0700, Atul Raut wrote: > Since zero-length arrays are deprecated, we are replacing > them with C99 flexible-array members. As a result, instead > of declaring a zero-length array, use the new > DECLARE_FLEX_ARRAY() helper macro. > > This fixes warnings such as: > ./drivers/net/ethernet/apple/macmace.c:80:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) > > Signed-off-by: Atul Raut > --- > drivers/net/ethernet/apple/macmace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/apple/macmace.c b/drivers/net/ethernet/apple/macmace.c > index 8fcaf1639920..8775c3234e91 100644 > --- a/drivers/net/ethernet/apple/macmace.c > +++ b/drivers/net/ethernet/apple/macmace.c > @@ -77,7 +77,7 @@ struct mace_frame { > u8 pad4; > u32 pad5; > u32 pad6; > - u8 data[1]; > + DECLARE_FLEX_ARRAY(u8, data); But data[1] is not zero-length array. > /* And frame continues.. */ > }; > > -- > 2.34.1 > > _______________________________________________ Linux-kernel-mentees mailing list Linux-kernel-mentees@lists.linuxfoundation.org https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C078F612C for ; Mon, 31 Jul 2023 07:38:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1945C433C8; Mon, 31 Jul 2023 07:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690789085; bh=2irsA3UR2NHCKzIxBwtohzjleSszhcLRIjmgEyuaMck=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F+cMlWCZ9AnK1U1TT0BCCvsTMMBUzz1S2KeRJk2jWn/BE+hSueutMV6RLeObOyFCG 3fkxj/VInSwsSwSQPjrwAErNehMCDiSLG1hRFFsPDVIeBkwz5CMEVNACWLOJlKRFxE xkD6P96uG/i5flDLGsD+Ei/YNH18ZofEVtWzxcopptzbg14V0m6kyjCNuUnghCXRug sWPqCNVmoaHtL7B+J0HAixmmcIyGOb71k0/bdITmtqjRYrusoNM6HrB2fcxudfglRs up0B5qcxpaOfXlIT4PR61CwxRTjTQWR1KJdDQmYZUqubOaXAFibERM7pQ6QlA/u556 /Q0apdTy+TjVg== Date: Mon, 31 Jul 2023 10:38:01 +0300 From: Leon Romanovsky To: Atul Raut Cc: avem@davemloft.net, netdev@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com, rafal@milecki.pl, linux-kernel-mentees@lists.linuxfoundation.org Subject: Re: [PATCH] net/macmace: Replace zero-length array with DECLARE_FLEX_ARRAY() helper Message-ID: <20230731073801.GA87829@unreal> References: <20230730231442.15003-1-rauji.raut@gmail.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230730231442.15003-1-rauji.raut@gmail.com> On Sun, Jul 30, 2023 at 04:14:42PM -0700, Atul Raut wrote: > Since zero-length arrays are deprecated, we are replacing > them with C99 flexible-array members. As a result, instead > of declaring a zero-length array, use the new > DECLARE_FLEX_ARRAY() helper macro. > > This fixes warnings such as: > ./drivers/net/ethernet/apple/macmace.c:80:4-8: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays) > > Signed-off-by: Atul Raut > --- > drivers/net/ethernet/apple/macmace.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/apple/macmace.c b/drivers/net/ethernet/apple/macmace.c > index 8fcaf1639920..8775c3234e91 100644 > --- a/drivers/net/ethernet/apple/macmace.c > +++ b/drivers/net/ethernet/apple/macmace.c > @@ -77,7 +77,7 @@ struct mace_frame { > u8 pad4; > u32 pad5; > u32 pad6; > - u8 data[1]; > + DECLARE_FLEX_ARRAY(u8, data); But data[1] is not zero-length array. > /* And frame continues.. */ > }; > > -- > 2.34.1 > >