From 1a1b674c2c0609facbbc6a54b966cf1ccd825c54 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 4 Mar 2021 16:53:27 +0100 Subject: [PATCH] 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. --- src/dns.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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; -- 1.7.10.4