From ddd6490abdb41e9737ba1b0c7e42a6da7596326d Mon Sep 17 00:00:00 2001 From: Mike Pattrick Date: Mon, 9 Sep 2024 00:55:05 -0400 Subject: [PATCH] mcast-snooping: Don't access ovs_list members directly. 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: Simon Horman Signed-off-by: Mike Pattrick Signed-off-by: Eelco Chaudron --- 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 bf25e6f20a0..b279c1229d2 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;