mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-05-01 15:28:00 +00:00
BUILD: quic: Move a ASSUME_NONNULL() for variable which is not null
Some new compilers warn that <oldest_lost> variable can be null even this cannot be the case as mentioned by the comment about an already present ASSUME_NONNULL() call comment. src/quic_loss.c: In function ‘qc_release_lost_pkts’: src/quic_loss.c:307:86: error: potential null pointer dereference [-Werror=null-dereference] 307 | unsigned int period = newest_lost->time_sent_ms - oldest_lost->time_sent_ms; | ~~~~~~~~~~~^~~~~~~~~~~~~~ Move up this ASSUME_NONNULL() statement to please these compiler. Must be backported as far as 2.6.
This commit is contained in:
parent
c956216477
commit
fbb45ea703
@ -283,6 +283,12 @@ int qc_release_lost_pkts(struct quic_conn *qc, struct quic_pktns *pktns,
|
|||||||
tot_lost++;
|
tot_lost++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* <oldest_lost> cannot be NULL at this stage because we have ensured
|
||||||
|
* that <pkts> list is not empty. Without this, GCC 12.2.0 reports a
|
||||||
|
* possible overflow on a 0 byte region with O2 optimization.
|
||||||
|
*/
|
||||||
|
ASSUME_NONNULL(oldest_lost);
|
||||||
|
|
||||||
if (!close) {
|
if (!close) {
|
||||||
if (newest_lost) {
|
if (newest_lost) {
|
||||||
struct quic_cc *cc = &qc->path->cc;
|
struct quic_cc *cc = &qc->path->cc;
|
||||||
@ -313,11 +319,6 @@ int qc_release_lost_pkts(struct quic_conn *qc, struct quic_pktns *pktns,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <oldest_lost> cannot be NULL at this stage because we have ensured
|
|
||||||
* that <pkts> list is not empty. Without this, GCC 12.2.0 reports a
|
|
||||||
* possible overflow on a 0 byte region with O2 optimization.
|
|
||||||
*/
|
|
||||||
ASSUME_NONNULL(oldest_lost);
|
|
||||||
quic_tx_packet_refdec(oldest_lost);
|
quic_tx_packet_refdec(oldest_lost);
|
||||||
if (newest_lost != oldest_lost)
|
if (newest_lost != oldest_lost)
|
||||||
quic_tx_packet_refdec(newest_lost);
|
quic_tx_packet_refdec(newest_lost);
|
||||||
|
Loading…
Reference in New Issue
Block a user