Commit e6e12977 authored by Kim Nordlund's avatar Kim Nordlund Committed by Adrian Bunk

[PKT_SCHED] act_gact: division by zero

Not returning -EINVAL, because someone might want to use the value
zero in some future gact_prob algorithm?
Signed-off-by: default avatarKim Nordlund <kim.nordlund@nokia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
parent a7c850eb
...@@ -55,14 +55,14 @@ static DEFINE_RWLOCK(gact_lock); ...@@ -55,14 +55,14 @@ static DEFINE_RWLOCK(gact_lock);
#ifdef CONFIG_GACT_PROB #ifdef CONFIG_GACT_PROB
static int gact_net_rand(struct tcf_gact *p) static int gact_net_rand(struct tcf_gact *p)
{ {
if (net_random()%p->pval) if (!p->pval || net_random()%p->pval)
return p->action; return p->action;
return p->paction; return p->paction;
} }
static int gact_determ(struct tcf_gact *p) static int gact_determ(struct tcf_gact *p)
{ {
if (p->bstats.packets%p->pval) if (!p->pval || p->bstats.packets%p->pval)
return p->action; return p->action;
return p->paction; return p->paction;
} }
......
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