Fix off-by-one bug which would cause a region at the end of the extent
to be alloctated multiple times: - we're allocating region of size 1 - there are holes in the extent, but all of size larger than 1 - there are 2 contigous allocations at the end of the extent, the last one being of size 1. While there fix a DIAGNOSTIC check: to check that a region is inside the extent we need to check start and end, not only start.
This commit is contained in:
parent
80f533ce07
commit
e97ceab999
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: subr_extent.c,v 1.50 2004/03/23 13:22:33 junyoung Exp $ */
|
||||
/* $NetBSD: subr_extent.c,v 1.51 2005/03/15 18:22:24 bouyer Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_extent.c,v 1.50 2004/03/23 13:22:33 junyoung Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_extent.c,v 1.51 2005/03/15 18:22:24 bouyer Exp $");
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include "opt_lockdebug.h"
|
||||
|
@ -677,7 +677,7 @@ extent_alloc_subregion1(ex, substart, subend, size, alignment, skew, boundary,
|
|||
* If the region pasts the subend, bail out and see
|
||||
* if we fit against the subend.
|
||||
*/
|
||||
if (rp->er_start >= subend) {
|
||||
if (rp->er_start > subend) {
|
||||
exend = rp->er_start;
|
||||
break;
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ extent_free(ex, start, size, flags)
|
|||
*/
|
||||
if (ex == NULL)
|
||||
panic("extent_free: NULL extent");
|
||||
if ((start < ex->ex_start) || (start > ex->ex_end)) {
|
||||
if ((start < ex->ex_start) || (end > ex->ex_end)) {
|
||||
extent_print(ex);
|
||||
printf("extent_free: extent `%s', start 0x%lx, size 0x%lx\n",
|
||||
ex->ex_name, start, size);
|
||||
|
|
Loading…
Reference in New Issue