Skip to content

bpf: Avoid thousands of -Wflex-array-members-not-at-end warnings#11274

Open
kernel-patches-daemon-bpf[bot] wants to merge 1 commit intobpf-next_basefrom
series/1060844=>bpf-next
Open

bpf: Avoid thousands of -Wflex-array-members-not-at-end warnings#11274
kernel-patches-daemon-bpf[bot] wants to merge 1 commit intobpf-next_basefrom
series/1060844=>bpf-next

Conversation

@kernel-patches-daemon-bpf
Copy link

Pull request for series with
subject: bpf: Avoid thousands of -Wflex-array-members-not-at-end warnings
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=1060844

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 05c9b2e
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1060844
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 4faa189
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1060844
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 748f9c6
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1060844
version: 1

-Wflex-array-member-not-at-end was introduced in GCC-14, and we are
getting ready to enable it, globally.

struct bpf_prog_array is a flexible structure, this is a structure that
contains a flexible-array member (struct bpf_prog_array_item items[];).

We create the new struct bpf_prog_array_hdr type, and use it to replace
the object type causing trouble in struct bpf_empty_prog_array, namely
struct bpf_prog_array hdr;

Also, once -fms-extensions is enabled, we can use transparent struct
members in struct bpf_prog_array.

Notice that the newly created type does not contain the flex-array
member `items`, which is the object causing the -Wfamnae warnings
in struct bpf_empty_prog_array.

With these changes, fix the following warnings:

7659 ./include/linux/bpf.h:2369:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: 6dd780f
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=1060844
version: 1

@kernel-patches-daemon-bpf kernel-patches-daemon-bpf bot force-pushed the series/1060844=>bpf-next branch from d86b517 to 3cf742b Compare March 5, 2026 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant