From: Christopher Faulet Date: Thu, 4 Mar 2021 15:53:27 +0000 (+0100) Subject: CLEANUP: dns: Use DISGUISE() on a never-failing ring_attach() call X-Git-Tag: v2.4-dev11~37 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=1a1b674c2c0609facbbc6a54b966cf1ccd825c54;p=haproxy-2.5.git CLEANUP: dns: Use DISGUISE() on a never-failing ring_attach() call When a DNS session is created, the call to ring_attach() never fails. The ring is freshly initialized and there is other watcher on it. Thus, the call always succeeds. Instead of catching an error that must never happen, we use the DISGUISE() macro to make static analyzers happy. --- diff --git a/src/dns.c b/src/dns.c index dcdc163..d360f2c 100644 --- a/src/dns.c +++ b/src/dns.c @@ -1028,13 +1028,8 @@ struct dns_session *dns_session_new(struct dns_stream_server *dss) goto error; ring_init(&ds->ring, ds->tx_ring_area, DNS_TCP_MSG_RING_MAX_SIZE); - if (!ring_attach(&ds->ring)) { - /* Should never happen - * since we are the first attached - * here - */ - goto error; - } + /* never fail because it is the first watcher attached to the ring */ + DISGUISE(ring_attach(&ds->ring)); if ((ds->task_exp = task_new(tid_bit)) == NULL) goto error;