X-Git-Url: http://git.cascardo.info/?a=blobdiff_plain;f=kernel%2Fresource.c;h=7640b3a947d03aac578bee5849324843a0866798;hb=9984de1a5a8a96275fcab818f7419af5a3c86e71;hp=3b3cedc52592164e11689375c4bb7d054df293cf;hpb=8e00f5fbb4ecbc3431fa686cba60cd76a62604af;p=cascardo%2Flinux.git diff --git a/kernel/resource.c b/kernel/resource.c index 3b3cedc52592..7640b3a947d0 100644 --- a/kernel/resource.c +++ b/kernel/resource.c @@ -7,7 +7,7 @@ * Arbitrary resource management. */ -#include +#include #include #include #include @@ -419,6 +419,9 @@ static int __find_resource(struct resource *root, struct resource *old, else tmp.end = root->end; + if (tmp.end < tmp.start) + goto next; + resource_clip(&tmp, constraint->min, constraint->max); arch_remove_reservations(&tmp); @@ -436,8 +439,10 @@ static int __find_resource(struct resource *root, struct resource *old, return 0; } } - if (!this) + +next: if (!this || this->end == root->end) break; + if (this != old) tmp.start = this->end + 1; this = this->sibling;