summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorKim Nordlund <kim.nordlund@nokia.com>2006-12-04 12:44:22 +0100
committerAdrian Bunk <bunk@stusta.de>2006-12-04 12:44:22 +0100
commite6e129777f0fb6619e6a845cfd7a87b7fcd736a0 (patch)
tree2c26caf22bbf135daf7112bb4c2e680e040a0527 /net
parenta7c850eb8180674fdd2957fb5f2e6dd5070fcc29 (diff)
[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: Adrian Bunk <bunk@stusta.de>
Diffstat (limited to 'net')
-rw-r--r--net/sched/act_gact.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index a1e68f78dcc2..d5571ee1369c 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -55,14 +55,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;
}