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 --- 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