Commit b2a6ba1a authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[PKT_SCHED]: tc actions: remove checks for impossible conditions

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2381b594
......@@ -85,7 +85,7 @@ static int tcf_gact_init(struct rtattr *rta, struct rtattr *est,
if (rtattr_parse(tb, TCA_GACT_MAX, RTA_DATA(rta), RTA_PAYLOAD(rta)) < 0)
return -1;
if (a == NULL || tb[TCA_GACT_PARMS - 1] == NULL) {
if (tb[TCA_GACT_PARMS - 1] == NULL) {
printk("BUG: tcf_gact_init called with NULL params\n");
return -1;
}
......@@ -140,12 +140,6 @@ tcf_gact(struct sk_buff **pskb, struct tc_action *a)
struct sk_buff *skb = *pskb;
int action = TC_ACT_SHOT;
if (p == NULL) {
if (net_ratelimit())
printk("BUG: tcf_gact called with NULL params\n");
return -1;
}
spin_lock(&p->lock);
#ifdef CONFIG_GACT_PROB
if (p->ptype && gact_rand[p->ptype] != NULL)
......@@ -173,11 +167,6 @@ tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
struct tcf_gact *p = PRIV(a, gact);
struct tcf_t t;
if (p == NULL) {
printk("BUG: tcf_gact_dump called with NULL params\n");
goto rtattr_failure;
}
opt.index = p->index;
opt.refcnt = p->refcnt - ref;
opt.bindcnt = p->bindcnt - bind;
......
......@@ -96,7 +96,7 @@ tcf_ipt_init(struct rtattr *rta, struct rtattr *est, struct tc_action *a,
u32 index = 0;
u32 hook = 0;
if (a == NULL || rta == NULL ||
if (rta == NULL ||
rtattr_parse(tb, TCA_IPT_MAX, RTA_DATA(rta), RTA_PAYLOAD(rta)) < 0)
return -1;
......@@ -238,9 +238,6 @@ tcf_ipt(struct sk_buff **pskb, struct tc_action *a)
struct tcf_ipt *p = PRIV(a, ipt);
struct sk_buff *skb = *pskb;
if (p == NULL || skb == NULL)
return -1;
spin_lock(&p->lock);
p->tm.lastuse = jiffies;
......@@ -288,10 +285,6 @@ tcf_ipt_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
unsigned char *b = skb->tail;
struct tcf_ipt *p = PRIV(a, ipt);
if (p == NULL) {
printk("BUG: tcf_ipt_dump called with NULL params\n");
goto rtattr_failure;
}
/* for simple targets kernel size == user size
** user name = target name
** for foolproof you need to not assume this
......
......@@ -90,7 +90,7 @@ tcf_mirred_init(struct rtattr *rta, struct rtattr *est, struct tc_action *a,
return -1;
}
if (a == NULL || tb[TCA_MIRRED_PARMS - 1] == NULL) {
if (tb[TCA_MIRRED_PARMS - 1] == NULL) {
DPRINTK("BUG: tcf_mirred_init called with NULL params\n");
return -1;
}
......@@ -169,27 +169,15 @@ tcf_mirred(struct sk_buff **pskb, struct tc_action *a)
struct sk_buff *skb = *pskb;
u32 at = G_TC_AT(skb->tc_verd);
if (a == NULL) {
if (net_ratelimit())
printk("BUG: tcf_mirred called with NULL action!\n");
return -1;
}
if (p == NULL) {
if (net_ratelimit())
printk("BUG: tcf_mirred called with NULL params\n");
return -1;
}
spin_lock(&p->lock);
dev = p->dev;
p->tm.lastuse = jiffies;
if (dev == NULL || !(dev->flags&IFF_UP) ) {
if (!(dev->flags&IFF_UP) ) {
if (net_ratelimit())
printk("mirred to Houston: device %s is gone!\n",
dev ? dev->name : "");
dev->name);
bad_mirred:
if (skb2 != NULL)
kfree_skb(skb2);
......@@ -237,11 +225,6 @@ tcf_mirred_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
struct tcf_mirred *p = PRIV(a, mirred);
struct tcf_t t;
if (p == NULL) {
printk("BUG: tcf_mirred_dump called with NULL params\n");
goto rtattr_failure;
}
opt.index = p->index;
opt.action = p->action;
opt.refcnt = p->refcnt - ref;
......
......@@ -65,7 +65,7 @@ tcf_pedit_init(struct rtattr *rta, struct rtattr *est, struct tc_action *a,
if (rtattr_parse(tb, TCA_PEDIT_MAX, RTA_DATA(rta),
RTA_PAYLOAD(rta)) < 0)
return -1;
if (a == NULL || tb[TCA_PEDIT_PARMS - 1] == NULL) {
if (tb[TCA_PEDIT_PARMS - 1] == NULL) {
printk("BUG: tcf_pedit_init called with NULL params\n");
return -1;
}
......@@ -113,11 +113,6 @@ tcf_pedit(struct sk_buff **pskb, struct tc_action *a)
int i, munged = 0;
u8 *pptr;
if (p == NULL) {
printk("BUG: tcf_pedit called with NULL params\n");
return -1; /* change to something symbolic */
}
if (!(skb->tc_verd & TC_OK2MUNGE)) {
/* should we set skb->cloned? */
if (pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
......@@ -189,11 +184,6 @@ tcf_pedit_dump(struct sk_buff *skb, struct tc_action *a,int bind, int ref)
struct tcf_t t;
int s;
if (p == NULL) {
printk("BUG: tcf_pedit_dump called with NULL params\n");
goto rtattr_failure;
}
s = sizeof(*opt) + p->nkeys * sizeof(struct tc_pedit_key);
/* netlink spinlocks held above us - must use ATOMIC */
......
......@@ -170,13 +170,6 @@ static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est,
struct tc_police *parm;
struct tcf_police *p;
if (a == NULL) {
if (net_ratelimit())
printk("BUG: tcf_police_locate called with NULL "
"params\n");
return -1;
}
if (rtattr_parse(tb, TCA_POLICE_MAX, RTA_DATA(rta),
RTA_PAYLOAD(rta)) < 0)
return -1;
......@@ -290,11 +283,6 @@ static int tcf_act_police(struct sk_buff **pskb, struct tc_action *a)
long toks;
long ptoks = 0;
if (p == NULL) {
printk("BUG: tcf_police called with NULL params\n");
return -1;
}
spin_lock(&p->lock);
p->bstats.bytes += skb->len;
......@@ -350,11 +338,6 @@ tcf_act_police_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
struct tc_police opt;
struct tcf_police *p = PRIV(a);
if (p == NULL) {
printk("BUG: tcf_police_dump called with NULL params\n");
goto rtattr_failure;
}
opt.index = p->index;
opt.action = p->action;
opt.mtu = p->mtu;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment