diff options
author | glebius <glebius@FreeBSD.org> | 2012-09-25 12:45:41 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2012-09-25 12:45:41 +0000 |
commit | 446cdf51f30f8f5ae3624d416fcbf0e066c36fa4 (patch) | |
tree | 549620064a46e217b7289e3f4a9d3ddab09f83c6 /sys/contrib | |
parent | 34732ca830cdb88299b81a21db8d8b6e75efbce2 (diff) | |
download | FreeBSD-src-446cdf51f30f8f5ae3624d416fcbf0e066c36fa4.zip FreeBSD-src-446cdf51f30f8f5ae3624d416fcbf0e066c36fa4.tar.gz |
Fix panic introduced by me in r240835, when zero weight
was passed to wtab_alloc().
Reported by: Kim Culhan <w8hdkim gmail.com>
Diffstat (limited to 'sys/contrib')
-rw-r--r-- | sys/contrib/altq/altq/altq_red.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/contrib/altq/altq/altq_red.c b/sys/contrib/altq/altq/altq_red.c index be9eff8..b92e005 100644 --- a/sys/contrib/altq/altq/altq_red.c +++ b/sys/contrib/altq/altq/altq_red.c @@ -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 |