From 33a6870fea5a204ab734dc723d1425330f537ec7 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 24 Nov 2022 09:16:41 +0100 Subject: [PATCH] BUILD: quic: silence two invalid build warnings at -O1 with gcc-6.5 Gcc 6.5 is now well known for triggering plenty of false "may be used uninitialized", particularly at -O1, and two of them happen in quic, quic_tp and quic_conn. Both of them were reviewed and easily confirmed as wrong (gcc seems to ignore the control flow after the function returns and believes error conditions are not met). Let's just preset the variables that bothers it. In quic_tp the initialization was moved out of the loop since there's no point inflating the code just to silence a stupid warning. --- src/quic_conn.c | 2 +- src/quic_tp.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/quic_conn.c b/src/quic_conn.c index dd748945f..4edd5f9e0 100644 --- a/src/quic_conn.c +++ b/src/quic_conn.c @@ -6089,7 +6089,7 @@ static int quic_rx_pkt_parse(struct quic_rx_packet *pkt, struct proxy *prx; struct quic_counters *prx_counters; int long_header = 0; - uint32_t version; + uint32_t version = 0; const struct quic_version *qv = NULL; TRACE_ENTER(QUIC_EV_CONN_LPKT); diff --git a/src/quic_tp.c b/src/quic_tp.c index 50fca0cde..78c456ae4 100644 --- a/src/quic_tp.c +++ b/src/quic_tp.c @@ -584,12 +584,11 @@ static int quic_transport_params_decode(struct quic_transport_params *p, int ser const unsigned char *end) { const unsigned char *pos; + uint64_t type, len = 0; pos = buf; while (pos != end) { - uint64_t type, len; - if (!quic_transport_param_decode_type_len(&type, &len, &pos, end)) return 0;