Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

chtls: Avoid -Wflex-array-member-not-at-end warning

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

Use the `DEFINE_RAW_FLEX()` helper for on-stack definitions of
a flexible structure where the size of the flexible-array member
is known at compile-time, and refactor the rest of the code,
accordingly.

So, with these changes, fix the following warning:

drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c:163:36: 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>
Link: https://patch.msgid.link/aSQocKoJGkN0wzEj@kspp
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Gustavo A. R. Silva and committed by
Jakub Kicinski
d696c737 864f3eda

+1 -7
+1 -7
drivers/net/ethernet/chelsio/inline_crypto/chtls/chtls_io.c
··· 159 159 int send_tx_flowc_wr(struct sock *sk, int compl, 160 160 u32 snd_nxt, u32 rcv_nxt) 161 161 { 162 - struct flowc_packed { 163 - struct fw_flowc_wr fc; 164 - struct fw_flowc_mnemval mnemval[FW_FLOWC_MNEM_MAX]; 165 - } __packed sflowc; 162 + DEFINE_RAW_FLEX(struct fw_flowc_wr, flowc, mnemval, FW_FLOWC_MNEM_MAX); 166 163 int nparams, paramidx, flowclen16, flowclen; 167 - struct fw_flowc_wr *flowc; 168 164 struct chtls_sock *csk; 169 165 struct tcp_sock *tp; 170 166 171 167 csk = rcu_dereference_sk_user_data(sk); 172 168 tp = tcp_sk(sk); 173 - memset(&sflowc, 0, sizeof(sflowc)); 174 - flowc = &sflowc.fc; 175 169 176 170 #define FLOWC_PARAM(__m, __v) \ 177 171 do { \