The Clang analyzer has trouble tracking the pointer usage in mrouter_get_lru and will report a use after free incorrectly. This patch migrates to using standard ovs_list functions instead of directly accessing the next member, which suppresses clang's warning.
Acked-by: Eelco Chaudron <[email protected]> Signed-off-by: Mike Pattrick <[email protected]> --- lib/mcast-snooping.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/mcast-snooping.c b/lib/mcast-snooping.c index bf25e6f20..b279c1229 100644 --- a/lib/mcast-snooping.c +++ b/lib/mcast-snooping.c @@ -653,7 +653,7 @@ mrouter_get_lru(const struct mcast_snooping *ms, OVS_REQ_RDLOCK(ms->rwlock) { if (!ovs_list_is_empty(&ms->mrouter_lru)) { - *m = mcast_mrouter_from_lru_node(ms->mrouter_lru.next); + *m = mcast_mrouter_from_lru_node(ovs_list_front(&ms->mrouter_lru)); return true; } else { *m = NULL; @@ -726,7 +726,7 @@ mcast_snooping_port_get(const struct ovs_list *list, struct mcast_port_bundle **f) { if (!ovs_list_is_empty(list)) { - *f = mcast_port_from_list_node(list->next); + *f = mcast_port_from_list_node(ovs_list_front(list)); return true; } else { *f = NULL; -- 2.43.5 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
