⬢ DragonFlyBSD Kernel Audit
DF-3536 / rehash_fix.diff
← back to finding ↓ download raw
--- a/sys/netgraph7/netgraph/ng_base.c
+++ b/sys/netgraph7/netgraph/ng_base.c
@@ -953,9 +953,7 @@
 
 	for (i = 0; i <= ng_name_hmask; i++) {
 		LIST_FOREACH_MUTABLE(node, &ng_name_hash[i], nd_nodes, node2) {
-#ifdef INVARIANTS
 			LIST_REMOVE(node, nd_nodes);
-#endif
 			hash = hash32_str(NG_NODE_NAME(node), HASHINIT) & hmask;
 			LIST_INSERT_HEAD(&new[hash], node, nd_nodes);
 		}
@@ -985,15 +983,13 @@
 
 	for (i = 0; i <= ng_ID_hmask; i++) {
 		LIST_FOREACH_MUTABLE(node, &ng_ID_hash[i], nd_idnodes, node2) {
-#ifdef INVARIANTS
 			LIST_REMOVE(node, nd_idnodes);
-#endif
 			hash = (node->nd_ID % (hmask + 1));
 			LIST_INSERT_HEAD(&new[hash], node, nd_idnodes);
 		}
 	}
 
-	hashdestroy(ng_ID_hash, M_NETGRAPH_NODE, ng_name_hmask);
+	hashdestroy(ng_ID_hash, M_NETGRAPH_NODE, ng_ID_hmask);
 	ng_ID_hash = new;
 	ng_ID_hmask = hmask;
 }