OSDN Git Service

net: sched: skip an unnecessay check
authorTom Rix <trix@redhat.com>
Mon, 7 Sep 2020 18:04:38 +0000 (11:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 Sep 2020 02:34:36 +0000 (19:34 -0700)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/act_api.c

index 063d8aa..f64af9d 100644 (file)
@@ -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);
 }