* [PATCH] net/macmace: Replace zero-length array with DECLARE_FLEX_ARRAY() helper @ 2023-07-30 23:14 Atul Raut 2023-07-31 7:38 ` Leon Romanovsky 2023-08-01 22:00 ` patchwork-bot+netdevbpf 0 siblings, 2 replies; 5+ messages in thread From: Atul Raut @ 2023-07-30 23:14 UTC (permalink / raw) To: avem; +Cc: netdev, kuba, pabeni, rafal, linux-kernel-mentees 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 <rauji.raut@gmail.com> --- 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); /* And frame continues.. */ }; -- 2.34.1 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net/macmace: Replace zero-length array with DECLARE_FLEX_ARRAY() helper 2023-07-30 23:14 [PATCH] net/macmace: Replace zero-length array with DECLARE_FLEX_ARRAY() helper Atul Raut @ 2023-07-31 7:38 ` Leon Romanovsky 2023-08-01 14:09 ` Larysa Zaremba 2023-08-01 22:00 ` patchwork-bot+netdevbpf 1 sibling, 1 reply; 5+ messages in thread From: Leon Romanovsky @ 2023-07-31 7:38 UTC (permalink / raw) To: Atul Raut; +Cc: avem, netdev, kuba, pabeni, rafal, 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 <rauji.raut@gmail.com> > --- > 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 > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net/macmace: Replace zero-length array with DECLARE_FLEX_ARRAY() helper 2023-07-31 7:38 ` Leon Romanovsky @ 2023-08-01 14:09 ` Larysa Zaremba 2023-08-01 21:51 ` Jakub Kicinski 0 siblings, 1 reply; 5+ messages in thread From: Larysa Zaremba @ 2023-08-01 14:09 UTC (permalink / raw) To: Atul Raut Cc: Larysa Zaremba, Atul Raut, avem, netdev, kuba, pabeni, rafal, linux-kernel-mentees On Mon, Jul 31, 2023 at 10:38:01AM +0300, Leon Romanovsky wrote: > 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 <rauji.raut@gmail.com> > > --- > > 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. > So, please, if you are certain that data should be a flexible array, send v2 without calling data a zero-length array. Also, with such change, I think driver code could be improved in many places in the same patchset. > > /* And frame continues.. */ > > }; > > > > -- > > 2.34.1 > > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net/macmace: Replace zero-length array with DECLARE_FLEX_ARRAY() helper 2023-08-01 14:09 ` Larysa Zaremba @ 2023-08-01 21:51 ` Jakub Kicinski 0 siblings, 0 replies; 5+ messages in thread From: Jakub Kicinski @ 2023-08-01 21:51 UTC (permalink / raw) To: Atul Raut Cc: Larysa Zaremba, avem, netdev, pabeni, rafal, linux-kernel-mentees On Tue, 1 Aug 2023 16:09:37 +0200 Larysa Zaremba wrote: > > > - u8 data[1]; > > > + DECLARE_FLEX_ARRAY(u8, data); > > > > But data[1] is not zero-length array. > > So, please, if you are certain that data should be a flexible array, > send v2 without calling data a zero-length array. Also, with such change, I > think driver code could be improved in many places in the same patchset. Atul, you should respond to reviewers promptly. These are legit questions. On closer inspection the patch looks fine so to avoid clogging up the review queue and wasting more time on it I'm just going to apply it. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net/macmace: Replace zero-length array with DECLARE_FLEX_ARRAY() helper 2023-07-30 23:14 [PATCH] net/macmace: Replace zero-length array with DECLARE_FLEX_ARRAY() helper Atul Raut 2023-07-31 7:38 ` Leon Romanovsky @ 2023-08-01 22:00 ` patchwork-bot+netdevbpf 1 sibling, 0 replies; 5+ messages in thread From: patchwork-bot+netdevbpf @ 2023-08-01 22:00 UTC (permalink / raw) To: Atul Raut; +Cc: avem, netdev, kuba, pabeni, rafal, linux-kernel-mentees Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <kuba@kernel.org>: On Sun, 30 Jul 2023 16:14:42 -0700 you 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) > > [...] Here is the summary with links: - net/macmace: Replace zero-length array with DECLARE_FLEX_ARRAY() helper https://git.kernel.org/netdev/net-next/c/005c9600003e You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-01 22:00 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-07-30 23:14 [PATCH] net/macmace: Replace zero-length array with DECLARE_FLEX_ARRAY() helper Atul Raut 2023-07-31 7:38 ` Leon Romanovsky 2023-08-01 14:09 ` Larysa Zaremba 2023-08-01 21:51 ` Jakub Kicinski 2023-08-01 22:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).