[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <12355496.O9o76ZdvQC@sven-l14>
Date: Tue, 02 Jan 2024 12:22:16 +0100
From: Sven Eckelmann <sven@...fation.org>
To: b.a.t.m.a.n@...ts.open-mesh.org, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org, Antonio Quartulli <a@...table.cc>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Marek Lindner <mareklindner@...mailbox.ch>,
Paolo Abeni <pabeni@...hat.com>, Simon Wunderlich <sw@...onwunderlich.de>,
Markus Elfring <Markus.Elfring@....de>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject:
Re: [PATCH 1/2] batman-adv: Return directly after a failed
batadv_dat_select_candidates() in batadv_dat_forward_data()
On Tuesday, 2 January 2024 08:11:47 CET Markus Elfring wrote:
> From: Markus Elfring <elfring@...rs.sourceforge.net>
> Date: Tue, 2 Jan 2024 07:27:45 +0100
>
> 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@...rs.sourceforge.net>
Acked-by: Sven Eckelmann <sven@...fation.org>
> ---
> 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 28a939d56090..4c7e85534324 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 @@ static bool batadv_dat_forward_data(struct batadv_priv *bat_priv,
> batadv_orig_node_put(cand[i].orig_node);
> }
>
> -out:
> kfree(cand);
> return ret;
> }
> --
> 2.43.0
>
>
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists