Skip to contentSkip to conversation

net/act_pedit: fix an error code

PATCH Applied Dan Carpenter 3 participants 3 messages Jun 14, 2017

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/act_pedit: fix an error code

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")
net/sched/act_pedit.c +3 -1
index 164b5ac094be..7dc5892671c8 100644
@@ -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;
 
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Dan Carpenter

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

You are right, it was intended to be -EINVAL. Thanks.

maintainer Applied
#2 lore raw
In reply to Dan Carpenter

From: Dan Carpenter <[email protected]>
Date: Wed, 14 Jun 2017 13:29:31 +0300

Quoted 7 lines

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

Applied.