Fix panic introduced by me in r240835, when zero weight

was passed to wtab_alloc().

Reported by:	Kim Culhan <w8hdkim gmail.com>
This commit is contained in:
Gleb Smirnoff 2012-09-25 12:45:41 +00:00
parent aa91d1a85c
commit 486e090204
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240918

View File

@ -235,6 +235,11 @@ red_alloc(int weight, int inv_pmax, int th_min, int th_max, int flags,
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 th_min, int th_max, int flags,
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