summaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorKim Nordlund <kim.nordlund@nokia.com>2006-12-01 20:21:44 -0800
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-02 21:32:11 -0800
commita163148c1bec895c1332ea5be497bcda8ce110df (patch)
tree8fbcb7c863c6ee4d422aaba0c496f945d6b45755 /net/sched
parent0b251df1039f560ef88a9180a80023e4f82596bd (diff)
downloadlinux-a163148c1bec895c1332ea5be497bcda8ce110df.tar.bz2
[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>
Diffstat (limited to 'net/sched')
-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 6cff56696a81..85de7efd5fea 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -48,14 +48,14 @@ static struct tcf_hashinfo gact_hash_info = {
#ifdef CONFIG_GACT_PROB
static int gact_net_rand(struct tcf_gact *gact)
{
- if (net_random() % gact->tcfg_pval)
+ if (!gact->tcfg_pval || net_random() % gact->tcfg_pval)
return gact->tcf_action;
return gact->tcfg_paction;
}
static int gact_determ(struct tcf_gact *gact)
{
- if (gact->tcf_bstats.packets % gact->tcfg_pval)
+ if (!gact->tcfg_pval || gact->tcf_bstats.packets % gact->tcfg_pval)
return gact->tcf_action;
return gact->tcfg_paction;
}