From 659fa0cbc36b44ddebb0eeeadf90e8882bec68ce Mon Sep 17 00:00:00 2001 From: Matthijs Mekking Date: Tue, 12 Mar 2024 14:12:23 +0100 Subject: [PATCH] Fix Coverity CID 487884: Dead code in qpcache.c Adding a changed record is zonedb related and does not belong in the cache code. This is a leftover dead code and can be safely removed. /lib/dns/qpcache.c: 3459 in add() 3453 } 3454 newheader->next = topheader->next; 3455 newheader->down = topheader; 3456 topheader->next = newheader; 3457 qpnode->dirty = 1; 3458 if (changed != NULL) { >>> CID 487884: (DEADCODE) >>> Execution cannot reach this statement: "changed->dirty = true;". 3459 changed->dirty = true; 3460 } 3461 } else { 3462 /* 3463 * No rdatasets of the given type exist at the node. 3464 */ /lib/dns/qpcache.c: 3409 in add() 3403 } 3404 newheader->next = topheader->next; 3405 newheader->down = topheader; 3406 topheader->next = newheader; 3407 qpnode->dirty = 1; 3408 if (changed != NULL) { >>> CID 487884: (DEADCODE) >>> Execution cannot reach this statement: "changed->dirty = true;". 3409 changed->dirty = true; 3410 } 3411 mark_ancient(header); 3412 if (sigheader != NULL) { 3413 mark_ancient(sigheader); 3414 --- lib/dns/qpcache.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/dns/qpcache.c b/lib/dns/qpcache.c index f9e2d379a2..481a20ad0b 100644 --- a/lib/dns/qpcache.c +++ b/lib/dns/qpcache.c @@ -3072,7 +3072,6 @@ add(dns_qpdb_t *qpdb, dns_qpdata_t *qpnode, const dns_name_t *nodename ISC_ATTR_UNUSED, dns_slabheader_t *newheader, unsigned int options, bool loading, dns_rdataset_t *addedrdataset, isc_stdtime_t now DNS__DB_FLARG) { - qpdb_changed_t *changed = NULL; dns_slabheader_t *topheader = NULL, *topheader_prev = NULL; dns_slabheader_t *header = NULL, *sigheader = NULL; dns_slabheader_t *prioheader = NULL; @@ -3405,9 +3404,6 @@ find_header: newheader->down = topheader; topheader->next = newheader; qpnode->dirty = 1; - if (changed != NULL) { - changed->dirty = true; - } mark_ancient(header); if (sigheader != NULL) { mark_ancient(sigheader); @@ -3455,9 +3451,6 @@ find_header: newheader->down = topheader; topheader->next = newheader; qpnode->dirty = 1; - if (changed != NULL) { - changed->dirty = true; - } } else { /* * No rdatasets of the given type exist at the node.