|
@@ -1817,7 +1817,8 @@ check_current:
|
|
|
/* Check if current node has a suitable gap */
|
|
|
if (gap_start > high_limit)
|
|
|
return -ENOMEM;
|
|
|
- if (gap_end >= low_limit && gap_end - gap_start >= length)
|
|
|
+ if (gap_end >= low_limit &&
|
|
|
+ gap_end > gap_start && gap_end - gap_start >= length)
|
|
|
goto found;
|
|
|
|
|
|
/* Visit right subtree if it looks promising */
|
|
@@ -1920,7 +1921,8 @@ check_current:
|
|
|
gap_end = vm_start_gap(vma);
|
|
|
if (gap_end < low_limit)
|
|
|
return -ENOMEM;
|
|
|
- if (gap_start <= high_limit && gap_end - gap_start >= length)
|
|
|
+ if (gap_start <= high_limit &&
|
|
|
+ gap_end > gap_start && gap_end - gap_start >= length)
|
|
|
goto found;
|
|
|
|
|
|
/* Visit left subtree if it looks promising */
|