[PATCH] 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: Kim Nordlund <kim.nordlund@nokia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
This commit is contained in:
David Miller
2006-12-01 20:36:44 -08:00
committed by Chris Wright
parent cf9a7875e6
commit 69ba0bfa9c
+2 -2
View File
@@ -54,14 +54,14 @@ static DEFINE_RWLOCK(gact_lock);
#ifdef CONFIG_GACT_PROB
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->paction;
}
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->paction;
}