mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 13:51:26 +02:00
BUILD: quic: Compilation fixes for some gcc warnings with -O1
This is to prevent the build from these gcc warning when compiling with -O1 option: willy@wtap:haproxy$ sh make-native-quic-memstat src/quic_conn.o CPU_CFLAGS="-O1" CC src/quic_conn.o src/quic_conn.c: In function 'qc_prep_pkts': src/quic_conn.c:3700:44: warning: potential null pointer dereference [-Wnull-dereference] 3700 | frms = &qel->pktns->tx.frms; | ~~~^~~~~~~ src/quic_conn.c:3626:33: warning: 'end' may be used uninitialized in this function [-Wmaybe-uninitialized] 3626 | if (end - pos < QUIC_INITIAL_PACKET_MINLEN) { | ~~~~^~~~~
This commit is contained in:
parent
7405874555
commit
f4d9fa4089
@ -3574,6 +3574,8 @@ static int qc_prep_pkts(struct quic_conn *qc, struct buffer *buf,
|
|||||||
padding = 0;
|
padding = 0;
|
||||||
pos = (unsigned char *)b_head(buf);
|
pos = (unsigned char *)b_head(buf);
|
||||||
first_pkt = prv_pkt = NULL;
|
first_pkt = prv_pkt = NULL;
|
||||||
|
end = pos; // just to let gcc know it will always be initialized
|
||||||
|
|
||||||
while (b_contig_space(buf) >= (int)qc->path->mtu + dg_headlen || prv_pkt) {
|
while (b_contig_space(buf) >= (int)qc->path->mtu + dg_headlen || prv_pkt) {
|
||||||
int err, probe, cc, must_ack;
|
int err, probe, cc, must_ack;
|
||||||
enum quic_pkt_type pkt_type;
|
enum quic_pkt_type pkt_type;
|
||||||
@ -3696,6 +3698,11 @@ static int qc_prep_pkts(struct quic_conn *qc, struct buffer *buf,
|
|||||||
next_tel = QUIC_TLS_ENC_LEVEL_APP;
|
next_tel = QUIC_TLS_ENC_LEVEL_APP;
|
||||||
tel = next_tel;
|
tel = next_tel;
|
||||||
qel = qc_quic_enc_level(qc, tel);
|
qel = qc_quic_enc_level(qc, tel);
|
||||||
|
|
||||||
|
/* This cannot happen. This is to please some compilers. */
|
||||||
|
if (!qel || !qel->pktns)
|
||||||
|
goto end_of_dgram;
|
||||||
|
|
||||||
/* Note that we cannot NULL as value for <qel> when for the Application
|
/* Note that we cannot NULL as value for <qel> when for the Application
|
||||||
* data encryption level. Furthermore this encryption is never released.
|
* data encryption level. Furthermore this encryption is never released.
|
||||||
*/
|
*/
|
||||||
@ -3711,6 +3718,7 @@ static int qc_prep_pkts(struct quic_conn *qc, struct buffer *buf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
end_of_dgram:
|
||||||
/* If we have to build a new datagram, set the current datagram as
|
/* If we have to build a new datagram, set the current datagram as
|
||||||
* prepared into <cbuf>.
|
* prepared into <cbuf>.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user