]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] PKT_SCHED act_gact: division by zero
authorDavid Miller <davem@davemloft.net>
Sat, 2 Dec 2006 04:36:44 +0000 (20:36 -0800)
committerChris Wright <chrisw@sous-sol.org>
Sun, 17 Dec 2006 00:20:47 +0000 (16:20 -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>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
net/sched/act_gact.c

index e75a147ad60fcb66f71729d6d25d15b04f18c80d..a29d0f667639084ccfcf9ff6b0f5f317915885cc 100644 (file)
@@ -54,14 +54,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;
 }