netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net/act_pedit: fix an error code
@ 2017-06-14 10:29 Dan Carpenter
  2017-06-14 13:20 ` Amir Vadai
  2017-06-14 19:31 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-06-14 10:29 UTC (permalink / raw)
  To: Jamal Hadi Salim, Amir Vadai
  Cc: Cong Wang, Jiri Pirko, David S. Miller, netdev, kernel-janitors

I'm reviewing static checker warnings where we do ERR_PTR(0), which is
the same as NULL.  I'm pretty sure we intended to return ERR_PTR(-EINVAL)
here.  Sometimes these bugs lead to a NULL dereference but I don't
immediately see that problem here.

Fixes: 71d0ed7079df ("net/act_pedit: Support using offset relative to the conventional network headers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index 164b5ac094be..7dc5892671c8 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -94,8 +94,10 @@ static struct tcf_pedit_key_ex *tcf_pedit_keys_ex_parse(struct nlattr *nla,
 		k++;
 	}
 
-	if (n)
+	if (n) {
+		err = -EINVAL;
 		goto err_out;
+	}
 
 	return keys_ex;
 

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

* Re: [PATCH net] net/act_pedit: fix an error code
  2017-06-14 10:29 [PATCH net] net/act_pedit: fix an error code Dan Carpenter
@ 2017-06-14 13:20 ` Amir Vadai
  2017-06-14 19:31 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Amir Vadai @ 2017-06-14 13:20 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David S. Miller, netdev,
	kernel-janitors

On Wed, Jun 14, 2017 at 01:29:31PM +0300, Dan Carpenter wrote:
> I'm reviewing static checker warnings where we do ERR_PTR(0), which is
> the same as NULL.  I'm pretty sure we intended to return ERR_PTR(-EINVAL)
> here.  Sometimes these bugs lead to a NULL dereference but I don't
> immediately see that problem here.
> 
> Fixes: 71d0ed7079df ("net/act_pedit: Support using offset relative to the conventional network headers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
You are right, it was intended to be -EINVAL. Thanks.

Acked-by: Amir Vadai <amir@vadai.me>

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

* Re: [PATCH net] net/act_pedit: fix an error code
  2017-06-14 10:29 [PATCH net] net/act_pedit: fix an error code Dan Carpenter
  2017-06-14 13:20 ` Amir Vadai
@ 2017-06-14 19:31 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-06-14 19:31 UTC (permalink / raw)
  To: dan.carpenter; +Cc: jhs, amir, xiyou.wangcong, jiri, netdev, kernel-janitors

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Wed, 14 Jun 2017 13:29:31 +0300

> I'm reviewing static checker warnings where we do ERR_PTR(0), which is
> the same as NULL.  I'm pretty sure we intended to return ERR_PTR(-EINVAL)
> here.  Sometimes these bugs lead to a NULL dereference but I don't
> immediately see that problem here.
> 
> Fixes: 71d0ed7079df ("net/act_pedit: Support using offset relative to the conventional network headers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied.

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

end of thread, other threads:[~2017-06-14 19:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-14 10:29 [PATCH net] net/act_pedit: fix an error code Dan Carpenter
2017-06-14 13:20 ` Amir Vadai
2017-06-14 19:31 ` 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).