Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] net: sched: skip an unnecessay check
@ 2020-09-07 18:04 trix
  2020-09-09  2:34 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: trix @ 2020-09-07 18:04 UTC (permalink / raw)
  To: jhs, xiyou.wangcong, jiri, davem, kuba; +Cc: netdev, linux-kernel, Tom Rix

From: Tom Rix <trix@redhat.com>

Reviewing the error handling in tcf_action_init_1()
most of the early handling uses

err_out:
	if (cookie) {
		kfree(cookie->data);
		kfree(cookie);
	}

before cookie could ever be set.

So skip the unnecessay check.

Signed-off-by: Tom Rix <trix@redhat.com>
---
 net/sched/act_api.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 063d8aaf2900..f64af9d9dfee 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -976,7 +976,7 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
 #endif
 		NL_SET_ERR_MSG(extack, "Failed to load TC action module");
 		err = -ENOENT;
-		goto err_out;
+		goto err_free;
 	}
 
 	/* backward compatibility for policer */
@@ -1013,11 +1013,12 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
 
 err_mod:
 	module_put(a_o->owner);
-err_out:
+err_free:
 	if (cookie) {
 		kfree(cookie->data);
 		kfree(cookie);
 	}
+err_out:
 	return ERR_PTR(err);
 }
 
-- 
2.18.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: sched: skip an unnecessay check
  2020-09-07 18:04 [PATCH] net: sched: skip an unnecessay check trix
@ 2020-09-09  2:34 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-09-09  2:34 UTC (permalink / raw)
  To: trix; +Cc: jhs, xiyou.wangcong, jiri, kuba, netdev, linux-kernel

From: trix@redhat.com
Date: Mon,  7 Sep 2020 11:04:38 -0700

> From: Tom Rix <trix@redhat.com>
> 
> Reviewing the error handling in tcf_action_init_1()
> most of the early handling uses
> 
> err_out:
> 	if (cookie) {
> 		kfree(cookie->data);
> 		kfree(cookie);
> 	}
> 
> before cookie could ever be set.
> 
> So skip the unnecessay check.
> 
> Signed-off-by: Tom Rix <trix@redhat.com>

Applied to net-next, thank you.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-09  2:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 18:04 [PATCH] net: sched: skip an unnecessay check trix
2020-09-09  2:34 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).