]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: quic: silence two invalid build warnings at -O1 with gcc-6.5
authorWilly Tarreau <w@1wt.eu>
Thu, 24 Nov 2022 08:16:41 +0000 (09:16 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 24 Nov 2022 08:16:41 +0000 (09:16 +0100)
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
src/quic_tp.c

index dd748945f449ef777a21530fbea3ac70e5f6ccdc..4edd5f9e00fadb37214dd9342aaf8bec4f844e28 100644 (file)
@@ -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);
index 50fca0cde8872526c373be4787d11f7a9a5d6dd3..78c456ae48c0d1a4381b587b5002ca869999a378 100644 (file)
@@ -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;