From: Kim Nordlund Date: Sat, 2 Dec 2006 04:21:44 +0000 (-0800) Subject: [PKT_SCHED] act_gact: division by zero X-Git-Tag: v2.6.20-rc2~6^2~13^2~56 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=a163148c1bec895c1332ea5be497bcda8ce110df;p=linux-2.6-omap-h63xx.git [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 Signed-off-by: David S. Miller --- diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index 6cff56696a8..85de7efd5fe 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; }