]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PKT_SCHED] act_gact: division by zero
authorKim Nordlund <kim.nordlund@nokia.com>
Sat, 2 Dec 2006 04:21:44 +0000 (20:21 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:32:11 +0000 (21:32 -0800)
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>
net/sched/act_gact.c

index 6cff56696a81dca4187cf649eb922bd2e906e637..85de7efd5fea7b29ca7a208633c5740f1a1762e5 100644 (file)
@@ -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;
 }