]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PKT_SCHED] act_gact: division by zero
authorKim Nordlund <kim.nordlund@nokia.com>
Mon, 4 Dec 2006 11:44:22 +0000 (12:44 +0100)
committerAdrian Bunk <bunk@stusta.de>
Mon, 4 Dec 2006 11:44:22 +0000 (12:44 +0100)
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>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
net/sched/act_gact.c

index a1e68f78dcc291359e297786b564d8b062fc2ffd..d5571ee1369cdd6c05c1a722a9794f1dd8bf2286 100644 (file)
@@ -55,14 +55,14 @@ static DEFINE_RWLOCK(gact_lock);
 #ifdef CONFIG_GACT_PROB
 static int gact_net_rand(struct tcf_gact *p)
 {
-       if (net_random()%p->pval)
+       if (!p->pval || net_random()%p->pval)
                return p->action;
        return p->paction;
 }
 
 static int gact_determ(struct tcf_gact *p)
 {
-       if (p->bstats.packets%p->pval)
+       if (!p->pval || p->bstats.packets%p->pval)
                return p->action;
        return p->paction;
 }