]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix undefined behaviour occurrences
authorAram Sargsyan <aram@isc.org>
Thu, 12 Oct 2023 14:10:43 +0000 (14:10 +0000)
committerAram Sargsyan <aram@isc.org>
Fri, 13 Oct 2023 09:57:28 +0000 (09:57 +0000)
The undefined behaviour was detected by LLVM 17. Fix the affected
functions definitions to match the expected function type.

lib/dns/nta.c
lib/dns/resolver.c
tests/isc/netmgr_common.c
tests/isc/netmgr_common.h

index 060fa6c32d38a5576d75204d72431954c96436c4..ce00b25d8a19e61346c037c2e7baf878673f7399 100644 (file)
@@ -579,7 +579,9 @@ dns_ntatable_save(dns_ntatable_t *ntatable, FILE *fp) {
 }
 
 static void
-dns__nta_shutdown_cb(dns__nta_t *nta) {
+dns__nta_shutdown_cb(void *arg) {
+       dns__nta_t *nta = arg;
+
        REQUIRE(VALID_NTA(nta));
 
        if (isc_log_wouldlog(dns_lctx, ISC_LOG_DEBUG(3))) {
@@ -602,7 +604,7 @@ dns__nta_shutdown(dns__nta_t *nta) {
        REQUIRE(VALID_NTA(nta));
 
        dns__nta_ref(nta);
-       isc_async_run(nta->loop, (isc_job_cb)dns__nta_shutdown_cb, nta);
+       isc_async_run(nta->loop, dns__nta_shutdown_cb, nta);
        nta->shuttingdown = true;
 }
 
index c9847e3b09c203858b1e5bd4fd7fc330914c6b6a..a3327fc9614629e9123e866b98c6aa45f521df56 100644 (file)
@@ -634,7 +634,7 @@ resquery_connected(isc_result_t eresult, isc_region_t *region, void *arg);
 static void
 fctx_try(fetchctx_t *fctx, bool retrying, bool badcache);
 static void
-fctx_shutdown(fetchctx_t *fctx);
+fctx_shutdown(void *arg);
 static void
 fctx_minimize_qname(fetchctx_t *fctx);
 static void
@@ -4369,7 +4369,9 @@ fctx_expired(void *arg) {
 }
 
 static void
-fctx_shutdown(fetchctx_t *fctx) {
+fctx_shutdown(void *arg) {
+       fetchctx_t *fctx = arg;
+
        REQUIRE(VALID_FCTX(fctx));
 
        fctx_done_unref(fctx, ISC_R_SHUTTINGDOWN);
@@ -10151,8 +10153,7 @@ dns_resolver_shutdown(dns_resolver_t *res) {
                        INSIST(fctx != NULL);
 
                        fetchctx_ref(fctx);
-                       isc_async_run(fctx->loop, (isc_job_cb)fctx_shutdown,
-                                     fctx);
+                       isc_async_run(fctx->loop, fctx_shutdown, fctx);
                }
                isc_hashmap_iter_destroy(&it);
                RWUNLOCK(&res->fctxs_lock, isc_rwlocktype_write);
@@ -10495,7 +10496,7 @@ dns_resolver_createfetch(dns_resolver_t *res, const dns_name_t *name,
 
        if (new_fctx) {
                fetchctx_ref(fctx);
-               isc_async_run(fctx->loop, (isc_job_cb)fctx_start, fctx);
+               isc_async_run(fctx->loop, fctx_start, fctx);
        }
 
 unlock:
index 300fb5e27fddaf599312d09f1e56bfbfb66e03fa..200ff988450496e3de299799286816300f5141e7 100644 (file)
@@ -235,7 +235,7 @@ noop_recv_cb(isc_nmhandle_t *handle ISC_ATTR_UNUSED,
 }
 
 isc_result_t
-noop_accept_cb(isc_nmhandle_t *handle ISC_ATTR_UNUSED, unsigned int eresult,
+noop_accept_cb(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t eresult,
               void *cbarg ISC_ATTR_UNUSED) {
        F();
 
index 0e86282b720d715efcb16fbf39743299cb5b3195..5e8eec620e280da42f5387942aea7fa3bd355574 100644 (file)
@@ -235,7 +235,7 @@ noop_recv_cb(isc_nmhandle_t *handle, isc_result_t eresult, isc_region_t *region,
             void *cbarg);
 
 isc_result_t
-noop_accept_cb(isc_nmhandle_t *handle ISC_ATTR_UNUSED, unsigned int result,
+noop_accept_cb(isc_nmhandle_t *handle ISC_ATTR_UNUSED, isc_result_t result,
               void *cbarg ISC_ATTR_UNUSED);
 
 void