From: David Miller Date: Sat, 2 Dec 2006 04:36:44 +0000 (-0800) Subject: [PATCH] PKT_SCHED act_gact: division by zero X-Git-Tag: v2.6.18.6~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=69ba0bfa9c9b97a0dfdfd1b631dec02883aa2b75;p=thirdparty%2Fkernel%2Fstable.git [PATCH] 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 Signed-off-by: Chris Wright --- diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index e75a147ad60fc..a29d0f6676390 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -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; }