Skip to content

Commit

Permalink
mcast-snooping: Don't access ovs_list members directly.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Mike Pattrick <[email protected]>
Signed-off-by: Eelco Chaudron <[email protected]>
  • Loading branch information
mkp-rh authored and chaudron committed Sep 11, 2024
1 parent 363435f commit ddd6490
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/mcast-snooping.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit ddd6490

Please sign in to comment.