* [RFC] misc: bcm-vk: avoid -Wflex-array-member-not-at-end warning
@ 2025-03-11 8:01 Gustavo A. R. Silva
2025-03-11 17:20 ` Scott Branden
0 siblings, 1 reply; 2+ messages in thread
From: Gustavo A. R. Silva @ 2025-03-11 8:01 UTC (permalink / raw)
To: Scott Branden, Arnd Bergmann, Greg Kroah-Hartman
Cc: Broadcom internal kernel review list, linux-kernel, linux-hardening
Hi all,
I'm trying to fix the following warning:
drivers/misc/bcm-vk/bcm_vk.h:415:32: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
after a quick look, I don't see any code directly using the flexible
array `data[]`, so this patch should probably suffice:
diff --git a/drivers/misc/bcm-vk/bcm_vk.h b/drivers/misc/bcm-vk/bcm_vk.h
index 386884c2a263..9344c2366a4b 100644
--- a/drivers/misc/bcm-vk/bcm_vk.h
+++ b/drivers/misc/bcm-vk/bcm_vk.h
@@ -311,7 +311,6 @@ struct bcm_vk_peer_log {
u32 wr_idx;
u32 buf_size;
u32 mask;
- char data[];
};
What do you think?
Thanks
--
Gustavo
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC] misc: bcm-vk: avoid -Wflex-array-member-not-at-end warning
2025-03-11 8:01 [RFC] misc: bcm-vk: avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
@ 2025-03-11 17:20 ` Scott Branden
0 siblings, 0 replies; 2+ messages in thread
From: Scott Branden @ 2025-03-11 17:20 UTC (permalink / raw)
To: Gustavo A. R. Silva, Arnd Bergmann, Greg Kroah-Hartman
Cc: Broadcom internal kernel review list, linux-kernel, linux-hardening
Hi Gustavo,
On 2025-03-11 01:01, Gustavo A. R. Silva wrote:
> Hi all,
>
> I'm trying to fix the following warning:
>
> drivers/misc/bcm-vk/bcm_vk.h:415:32: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
>
> after a quick look, I don't see any code directly using the flexible
> array `data[]`, so this patch should probably suffice:
>
> diff --git a/drivers/misc/bcm-vk/bcm_vk.h b/drivers/misc/bcm-vk/bcm_vk.h
> index 386884c2a263..9344c2366a4b 100644
> --- a/drivers/misc/bcm-vk/bcm_vk.h
> +++ b/drivers/misc/bcm-vk/bcm_vk.h
> @@ -311,7 +311,6 @@ struct bcm_vk_peer_log {
> u32 wr_idx;
> u32 buf_size;
> u32 mask;
> - char data[];
> };
>
> What do you think?
If it is changed to data[0] does the warning go away? If not, you could
remove it or change the code to use it instead of the sizeof used to
calculate peer offset.
>
> Thanks
> --
> Gustavo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-11 17:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-11 8:01 [RFC] misc: bcm-vk: avoid -Wflex-array-member-not-at-end warning Gustavo A. R. Silva
2025-03-11 17:20 ` Scott Branden
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®