Repository : ssh://git@diktynna/batman-adv On branches: main,main
commit bfeb9d0ea60a5f6099a5d3b3d41df44003c7fc92 Author: Markus Elfring elfring@users.sourceforge.net Date: Tue Jan 2 07:27:45 2024 +0100
batman-adv: Return directly after a failed batadv_dat_select_candidates() in batadv_dat_forward_data()
The kfree() function was called in one case by the batadv_dat_forward_data() function during error handling even if the passed variable contained a null pointer. This issue was detected by using the Coccinelle software.
* Thus return directly after a batadv_dat_select_candidates() call failed at the beginning.
* Delete the label “out” which became unnecessary with this refactoring.
Signed-off-by: Markus Elfring elfring@users.sourceforge.net Acked-by: Sven Eckelmann sven@narfation.org Signed-off-by: Sven Eckelmann sven@narfation.org
bfeb9d0ea60a5f6099a5d3b3d41df44003c7fc92 net/batman-adv/distributed-arp-table.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c index 28a939d5..4c7e8553 100644 --- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c @@ -684,7 +684,7 @@ static bool batadv_dat_forward_data(struct batadv_priv *bat_priv,
cand = batadv_dat_select_candidates(bat_priv, ip, vid); if (!cand) - goto out; + return ret;
batadv_dbg(BATADV_DBG_DAT, bat_priv, "DHT_SEND for %pI4\n", &ip);
@@ -728,7 +728,6 @@ free_orig: batadv_orig_node_put(cand[i].orig_node); }
-out: kfree(cand); return ret; }