[RFC 4/7] net/zxdh: work around GCC bitfield uninit false positive
Stephen Hemminger
stephen at networkplumber.org
Thu May 21 06:17:04 CEST 2026
GCC's -Wmaybe-uninitialized analysis cannot follow struct
initialization through bitfield reads. The warning is currently
masked by inline assembly elsewhere limiting analysis depth; it
surfaces once the EAL atomic and spinlock primitives switch to
compiler intrinsics.
Replace the struct initializer with an explicit memset() so the
full-width initialization is visible to the analyzer.
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85301
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110743
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/net/zxdh/zxdh_msg.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/zxdh/zxdh_msg.c b/drivers/net/zxdh/zxdh_msg.c
index 4b01daf37a..8f88181a3f 100644
--- a/drivers/net/zxdh/zxdh_msg.c
+++ b/drivers/net/zxdh/zxdh_msg.c
@@ -728,13 +728,15 @@ zxdh_bar_chan_sync_msg_reps_get(uint64_t subchan_addr,
int
zxdh_bar_chan_sync_msg_send(struct zxdh_pci_bar_msg *in, struct zxdh_msg_recviver_mem *result)
{
- struct zxdh_bar_msg_header msg_header = {0};
+ struct zxdh_bar_msg_header msg_header;
uint16_t seq_id = 0;
uint64_t subchan_addr = 0;
uint32_t time_out_cnt = 0;
uint16_t valid = 0;
int ret = 0;
+ memset(&msg_header, 0, sizeof(msg_header));
+
ret = zxdh_bar_chan_send_para_check(in, result);
if (ret != ZXDH_BAR_MSG_OK)
goto exit;
--
2.53.0
More information about the dev
mailing list