aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorKim Nordlund <kim.nordlund@nokia.com>2006-12-01 23:21:44 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:32:11 -0500
commita163148c1bec895c1332ea5be497bcda8ce110df (patch)
tree8fbcb7c863c6ee4d422aaba0c496f945d6b45755 /net
parent0b251df1039f560ef88a9180a80023e4f82596bd (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>
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 = {
48#ifdef CONFIG_GACT_PROB 48#ifdef CONFIG_GACT_PROB
49static int gact_net_rand(struct tcf_gact *gact) 49static int gact_net_rand(struct tcf_gact *gact)
50{ 50{
51 if (net_random() % gact->tcfg_pval) 51 if (!gact->tcfg_pval || net_random() % gact->tcfg_pval)
52 return gact->tcf_action; 52 return gact->tcf_action;
53 return gact->tcfg_paction; 53 return gact->tcfg_paction;
54} 54}
55 55
56static int gact_determ(struct tcf_gact *gact) 56static int gact_determ(struct tcf_gact *gact)
57{ 57{
58 if (gact->tcf_bstats.packets % gact->tcfg_pval) 58 if (!gact->tcfg_pval || gact->tcf_bstats.packets % gact->tcfg_pval)
59 return gact->tcf_action; 59 return gact->tcf_action;
60 return gact->tcfg_paction; 60 return gact->tcfg_paction;
61} 61}