summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavoars@kernel.org>2025-11-27 12:21:14 +0900
committerKees Cook <kees@kernel.org>2026-01-17 11:00:37 -0800
commitee4acc596786ab08db7b5d4de4dfa15a67c9e684 (patch)
treea3a70c5626ffb73f52f87ce8e9ffa63555b09f02 /include
parentcd8da637106d6a1924c0d6dd05e8ee932ef234b5 (diff)
nfp: tls: Avoid -Wflex-array-member-not-at-end warnings
-Wflex-array-member-not-at-end was introduced in GCC-14, and we are getting ready to enable it, globally. So, in order to avoid ending up with flexible-array members in the middle of other structs, we use the `struct_group_tagged()` helper to separate the flexible array from the rest of the members in the flexible structure. We then use the newly created tagged `struct nfp_crypto_req_add_front_hdr` to replace the type of the objects causing trouble in a couple of structures. We also want to ensure that when new members need to be added to the flexible structure, they are always included within the newly created tagged struct. For this, we use `static_assert()`. This ensures that the memory layout for both the flexible structure and the new tagged struct is the same after any changes. Lastly, use container_of() to retrieve a pointer to the flexible structure and, through that, access the flexible-array member when needed. So, with these changes, fix the following warnings: drivers/net/ethernet/netronome/nfp/nfd3/../crypto/fw.h:58:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] drivers/net/ethernet/netronome/nfp/nfd3/../crypto/fw.h:65:41: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Link: https://patch.msgid.link/aSfDqouLFcA4h8JX@kspp Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions