Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1947564AbWLIAIH (ORCPT ); Fri, 8 Dec 2006 19:08:07 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1947524AbWLIAHW (ORCPT ); Fri, 8 Dec 2006 19:07:22 -0500 Received: from 216-99-217-87.dsl.aracnet.com ([216.99.217.87]:37512 "EHLO sous-sol.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1947531AbWLHX7b (ORCPT ); Fri, 8 Dec 2006 18:59:31 -0500 Message-Id: <20061209000003.819937000@sous-sol.org> References: <20061208235751.890503000@sous-sol.org> User-Agent: quilt/0.45-1 Date: Fri, 08 Dec 2006 15:58:01 -0800 From: Chris Wright To: linux-kernel@vger.kernel.org, stable@kernel.org Cc: Justin Forbes , Zwane Mwaikambo , "Theodore Ts'o" , Randy Dunlap , Dave Jones , Chuck Wolber , Chris Wedgwood , Michael Krufky , torvalds@osdl.org, akpm@osdl.org, alan@lxorguk.ukuu.org.uk, David Miller , bunk@stusta.de, Kim Nordlund Subject: [patch 10/32] PKT_SCHED act_gact: division by zero Content-Disposition: inline; filename=pkt_sched-act_gact-division-by-zero.patch Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1343 Lines: 41 -stable review patch. If anyone has any objections, please let us know. ------------------ From: David Miller 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 --- net/sched/act_gact.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- linux-2.6.19.orig/net/sched/act_gact.c +++ linux-2.6.19/net/sched/act_gact.c @@ -48,14 +48,14 @@ static struct tcf_hashinfo gact_hash_inf #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; } -- - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/