From patchwork Thu Feb 1 11:07:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Wunderlich X-Patchwork-Id: 18632 X-Patchwork-Delegate: sw@simonwunderlich.de Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from diktynna.open-mesh.org (localhost [IPv6:::1]) by diktynna.open-mesh.org (Postfix) with ESMTP id C2AF484350 for ; Thu, 1 Feb 2024 12:09:59 +0100 (CET) ARC-Seal: i=2; cv=pass; a=rsa-sha256; d=open-mesh.org; s=20121; t=1706785799; b=JMnKk5/7OmyznOQYMRfPx6SvAjj/S9owo+RDzg01IduSe+ELtOCKOVYjXPLjUceSTT+P3 A6vaNlG3ozuuWuTSl0DXZYecDCjOaPAPTV+1xEQ33wgw7tduNHu9JcVXz88bRQFhpbtPpse Ag/Q4d7T8l7W44JJR7DyLE0i6An+7e8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1706785799; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=Kmhfb/8f2incvPKVY3XPnMqKoh4ReDpDQYpclE2lp0Q=; b=JNBUgbCCdKhhrCle7/FqMka7u8RU9kD5y7Y8mFsb027WeDuNyXtfwbei2CPMsvl8xmNay ur5VDLSEaGyPvdPrTaBtHJOf2xnpaOgvAccyjz6Jo4t64R/9blWgIEwmnS8uk+WmKCSNDO8 FfGU+qlRcSKMwqLgaZAUzeoO3utf7Qg= ARC-Authentication-Results: i=2; open-mesh.org; dkim=fail; arc=pass; dmarc=fail (Used From Domain Record) header.from=simonwunderlich.de policy.dmarc=none Authentication-Results: open-mesh.org; dkim=fail; arc=pass; dmarc=fail (Used From Domain Record) header.from=simonwunderlich.de policy.dmarc=none Received: from mail.simonwunderlich.de (mail.simonwunderlich.de [23.88.38.48]) by diktynna.open-mesh.org (Postfix) with ESMTPS id 3982182E57 for ; Thu, 1 Feb 2024 12:08:00 +0100 (CET) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=open-mesh.org; s=20121; t=1706785680; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Kmhfb/8f2incvPKVY3XPnMqKoh4ReDpDQYpclE2lp0Q=; b=1EBA9/9syCPGIbW9dRJBt0Hj16bXmDC9YIK8ADihQXu4n/X1SEj/C7w9S7Gq6lu4kozp6+ Vq78qJGvDRivEzcPU4VkSm+XcWHDoo6lB4CJKAyXqGVuOKjJ3n3dyIdwxah/wgEfRCHGkm 8ZBXWPeFWVWNus8RB65cfKwbpddlM1Y= ARC-Authentication-Results: i=1; diktynna.open-mesh.org; dkim=none; spf=pass (diktynna.open-mesh.org: domain of sw@simonwunderlich.de designates 23.88.38.48 as permitted sender) smtp.mailfrom=sw@simonwunderlich.de; dmarc=pass (policy=none) header.from=simonwunderlich.de ARC-Seal: i=1; s=20121; d=open-mesh.org; t=1706785680; a=rsa-sha256; cv=none; b=QOIIv2w7SxurZ6Tj+wpKNjDJDpC/0zEhvGQmFtr5Az1qXfzf1Y/pTwSERqoZ+louK8kv1/ Z6ndWq0buWH4D3KQziYdYi/e4hWclV/lNXd6lbPDYFn2GygBpEsrM4aXI73ldgGYq2d/zG XJCjbfSt+uUT1nDWb4nszw9l0CEygSo= Received: from kero.packetmixer.de (p200300C59712C7d8D89318FB9D63B559.dip0.t-ipconnect.de [IPv6:2003:c5:9712:c7d8:d893:18fb:9d63:b559]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.simonwunderlich.de (Postfix) with ESMTPSA id B2ED4FA9B4; Thu, 1 Feb 2024 12:07:59 +0100 (CET) From: Simon Wunderlich To: kuba@kernel.org, davem@davemloft.net Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org, Markus Elfring , Sven Eckelmann , Simon Wunderlich Subject: [PATCH 2/4] batman-adv: Return directly after a failed batadv_dat_select_candidates() in batadv_dat_forward_data() Date: Thu, 1 Feb 2024 12:07:54 +0100 Message-Id: <20240201110756.29728-3-sw@simonwunderlich.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240201110756.29728-1-sw@simonwunderlich.de> References: <20240201110756.29728-1-sw@simonwunderlich.de> MIME-Version: 1.0 Message-ID-Hash: 3KT2ICN5MCHDZNIFMO372SSOFF6A6QHA X-Message-ID-Hash: 3KT2ICN5MCHDZNIFMO372SSOFF6A6QHA X-MailFrom: sw@simonwunderlich.de X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-b.a.t.m.a.n.lists.open-mesh.org-0; header-match-b.a.t.m.a.n.lists.open-mesh.org-1; header-match-b.a.t.m.a.n.lists.open-mesh.org-2; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Markus Elfring 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 Acked-by: Sven Eckelmann Signed-off-by: Simon Wunderlich --- 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; }