lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250813125915.854233-1-yuehaibing@huawei.com>
Date: Wed, 13 Aug 2025 20:59:15 +0800
From: Yue Haibing <yuehaibing@...wei.com>
To: <jhs@...atatu.com>, <xiyou.wangcong@...il.com>, <jiri@...nulli.us>,
	<davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
	<pabeni@...hat.com>, <horms@...nel.org>, <vladimir.oltean@....com>
CC: <netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH net-next] net/sched: act_api: Remove unnecessary nlmsg_trim()

If tca_get_fill() fails, all callers free the skb immediately, no need to
trim it back to the previous size.

Signed-off-by: Yue Haibing <yuehaibing@...wei.com>
---
 net/sched/act_api.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 9e468e463467..54c92d0755c9 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -1649,7 +1649,7 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
 
 	nlh = nlmsg_put(skb, portid, seq, event, sizeof(*t), flags);
 	if (!nlh)
-		goto out_nlmsg_trim;
+		goto out;
 	t = nlmsg_data(nlh);
 	t->tca_family = AF_UNSPEC;
 	t->tca__pad1 = 0;
@@ -1657,14 +1657,14 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
 
 	if (extack && extack->_msg &&
 	    nla_put_string(skb, TCA_ROOT_EXT_WARN_MSG, extack->_msg))
-		goto out_nlmsg_trim;
+		goto out;
 
 	nest = nla_nest_start_noflag(skb, TCA_ACT_TAB);
 	if (!nest)
-		goto out_nlmsg_trim;
+		goto out;
 
 	if (tcf_action_dump(skb, actions, bind, ref, false) < 0)
-		goto out_nlmsg_trim;
+		goto out;
 
 	nla_nest_end(skb, nest);
 
@@ -1672,8 +1672,7 @@ static int tca_get_fill(struct sk_buff *skb, struct tc_action *actions[],
 
 	return skb->len;
 
-out_nlmsg_trim:
-	nlmsg_trim(skb, b);
+out:
 	return -1;
 }
 
-- 
2.33.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ