summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Nordlund <kim.nordlund@nokia.com>2006-12-02 05:21:44 +0100
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 06:32:11 +0100
commita163148c1bec895c1332ea5be497bcda8ce110df (patch)
tree8fbcb7c863c6ee4d422aaba0c496f945d6b45755 /net
parent[NETFILTER]: Kill ip_queue from feature removal schedule. (diff)
downloadlinux-a163148c1bec895c1332ea5be497bcda8ce110df.tar.xz
linux-a163148c1bec895c1332ea5be497bcda8ce110df.zip
[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')
-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;
}