Skip to content

Commit 753df96

Browse files
Baoquan Heakpm00
authored andcommitted
mm/vmalloc: remove the redundant boundary check
In find_va_links(), when traversing the vmap_area tree, the comparing to check if the passed in 'va' is above or below 'tmp_va' is redundant, assuming both 'va' and 'tmp_va' has ->va_start <= ->va_end. Here, to simplify the checking as code change. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Baoquan He <[email protected]> Reviewed-by: Uladzislau Rezki (Sony) <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 1b23ff8 commit 753df96

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

mm/vmalloc.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -874,11 +874,9 @@ find_va_links(struct vmap_area *va,
874874
* Trigger the BUG() if there are sides(left/right)
875875
* or full overlaps.
876876
*/
877-
if (va->va_start < tmp_va->va_end &&
878-
va->va_end <= tmp_va->va_start)
877+
if (va->va_end <= tmp_va->va_start)
879878
link = &(*link)->rb_left;
880-
else if (va->va_end > tmp_va->va_start &&
881-
va->va_start >= tmp_va->va_end)
879+
else if (va->va_start >= tmp_va->va_end)
882880
link = &(*link)->rb_right;
883881
else {
884882
WARN(1, "vmalloc bug: 0x%lx-0x%lx overlaps with 0x%lx-0x%lx\n",

0 commit comments

Comments
 (0)