Fix an edge case in rman_manage_region() where it didn't handle a resource
ending at ULONG_MAX properly. While here, use TAILQ_FOREACH_SAFE(). Tested by: "Stephane E. Potvin" <sepotvin at videotron-ca> MFC after: 1 week
This commit is contained in:
parent
daacddcac8
commit
5505470e4a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=164881
@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/limits.h>
|
||||
#include <sys/lock.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mutex.h>
|
||||
@ -169,10 +170,12 @@ rman_manage_region(struct rman *rm, u_long start, u_long end)
|
||||
mtx_lock(rm->rm_mtx);
|
||||
|
||||
/* Skip entries before us. */
|
||||
for (s = TAILQ_FIRST(&rm->rm_list);
|
||||
s && s->r_end + 1 < r->r_start;
|
||||
s = TAILQ_NEXT(s, r_link))
|
||||
;
|
||||
TAILQ_FOREACH(s, &rm->rm_list, r_link) {
|
||||
if (s->r_end == ULONG_MAX)
|
||||
break;
|
||||
if (s->r_end + 1 >= r->r_start)
|
||||
break;
|
||||
}
|
||||
|
||||
/* If we ran off the end of the list, insert at the tail. */
|
||||
if (s == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user