Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Sep 2012 12:45:41 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240918 - head/sys/contrib/altq/altq
Message-ID:  <201209251245.q8PCjfe8031366@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Tue Sep 25 12:45:41 2012
New Revision: 240918
URL: http://svn.freebsd.org/changeset/base/240918

Log:
  Fix panic introduced by me in r240835, when zero weight
  was passed to wtab_alloc().
  
  Reported by:	Kim Culhan <w8hdkim gmail.com>

Modified:
  head/sys/contrib/altq/altq/altq_red.c

Modified: head/sys/contrib/altq/altq/altq_red.c
==============================================================================
--- head/sys/contrib/altq/altq/altq_red.c	Tue Sep 25 10:52:49 2012	(r240917)
+++ head/sys/contrib/altq/altq/altq_red.c	Tue Sep 25 12:45:41 2012	(r240918)
@@ -235,6 +235,11 @@ red_alloc(int weight, int inv_pmax, int 
 	if (rp == NULL)
 		return (NULL);
 
+	if (weight == 0)
+		rp->red_weight = W_WEIGHT;
+	else
+		rp->red_weight = weight;
+
 	/* allocate weight table */
 	rp->red_wtab = wtab_alloc(rp->red_weight);
 	if (rp->red_wtab == NULL) {
@@ -245,10 +250,6 @@ red_alloc(int weight, int inv_pmax, int 
 	rp->red_avg = 0;
 	rp->red_idle = 1;
 
-	if (weight == 0)
-		rp->red_weight = W_WEIGHT;
-	else
-		rp->red_weight = weight;
 	if (inv_pmax == 0)
 		rp->red_inv_pmax = default_inv_pmax;
 	else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209251245.q8PCjfe8031366>