From: Remi Gacogne Date: Wed, 1 Mar 2023 10:34:02 +0000 (+0100) Subject: dnsdist: Prevent a false-positive warning from the compiler X-Git-Tag: dnsdist-1.9.0-rc1^2~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d7a4f1fd253facecdd529d255fec713da2bd3bd3;p=thirdparty%2Fpdns.git dnsdist: Prevent a false-positive warning from the compiler ``` In file included from xsk.hh:50, from xsk.cc:23: In function ‘xdp_desc* xsk_ring_prod__tx_desc(xsk_ring_prod*, __u32)’, inlined from ‘void XskSocket::send(std::vector, std::allocator > >&)’ at xsk.cc:176:28: /usr/include/xdp/xsk.h:76:27: warning: ‘idx’ may be used uninitialized [-Wmaybe-uninitialized] 76 | return &descs[idx & tx->mask]; | ~~~~^~~~~~~~~~ ``` --- diff --git a/pdns/xsk.cc b/pdns/xsk.cc index f43d4a3c85..778d3cf4ae 100644 --- a/pdns/xsk.cc +++ b/pdns/xsk.cc @@ -167,7 +167,7 @@ void XskSocket::send(std::vector& packets) if (packetSize == 0) { return; } - uint32_t idx; + uint32_t idx{0}; if (xsk_ring_prod__reserve(&tx, packetSize, &idx) != packets.size()) { return; }