]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/act_pedit: fix an error code
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 14 Jun 2017 10:29:31 +0000 (13:29 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 14 Jun 2017 19:24:18 +0000 (15:24 -0400)
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: 30a225a4c8f2 ("net/act_pedit: Support using offset relative to the conventional network headers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Amir Vadai <amir@vadai.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/act_pedit.c

index 164b5ac094be6d8bbd7a04aa8aa962a3c693ab44..7dc5892671c818db55b024b10d56ec2252c2f826 100644 (file)
@@ -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;