From: Christian Marangi Date: Sat, 24 Jun 2023 12:34:12 +0000 (+0200) Subject: bridge: fix coverity false positive report X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=493e1589bc8b67a34d2576c5793dfc4ffc9e52ed;p=project%2Fnetifd.git bridge: fix coverity false positive report Fix Coverity Defect 1532481 reporting a Resource leak when !bm->node.avl.key is false in bridge_hotplug_add. This is not a real issue, since bm->node.avl.key is always NULL for newly allocated entries and guaranteed to be non-NULL for entries returned by vlist_find. Fixes: edf3aced9f9a ("bridge: add support for adding vlan ranges via hotplug") Signed-off-by: Christian Marangi Signed-off-by: Felix Fietkau --- diff --git a/bridge.c b/bridge.c index 471c651..2e9cca3 100644 --- a/bridge.c +++ b/bridge.c @@ -930,12 +930,15 @@ bridge_hotplug_add(struct device *dev, struct device *member, struct blob_attr * { struct bridge_state *bst = container_of(dev, struct bridge_state, dev); struct bridge_member *bm; + bool new_entry = false; bm = vlist_find(&bst->members, member->ifname, bm, node); - if (!bm) + if (!bm) { + new_entry = true; bm = bridge_alloc_member(bst, member->ifname, member, true); + } bridge_hotplug_set_member_vlans(bst, vlan, member->ifname, bm, true); - if (!bm->node.avl.key) + if (new_entry) bridge_insert_member(bm, member->ifname); return 0;