diff options
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r-- | mm/vmalloc.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index e03f4c7307a5..2bb90b1d241c 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -413,11 +413,11 @@ nocache: | |||
413 | if (addr + size - 1 < addr) | 413 | if (addr + size - 1 < addr) |
414 | goto overflow; | 414 | goto overflow; |
415 | 415 | ||
416 | n = rb_next(&first->rb_node); | 416 | if (list_is_last(&first->list, &vmap_area_list)) |
417 | if (n) | ||
418 | first = rb_entry(n, struct vmap_area, rb_node); | ||
419 | else | ||
420 | goto found; | 417 | goto found; |
418 | |||
419 | first = list_entry(first->list.next, | ||
420 | struct vmap_area, list); | ||
421 | } | 421 | } |
422 | 422 | ||
423 | found: | 423 | found: |
@@ -904,6 +904,14 @@ static void *vb_alloc(unsigned long size, gfp_t gfp_mask) | |||
904 | 904 | ||
905 | BUG_ON(size & ~PAGE_MASK); | 905 | BUG_ON(size & ~PAGE_MASK); |
906 | BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC); | 906 | BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC); |
907 | if (WARN_ON(size == 0)) { | ||
908 | /* | ||
909 | * Allocating 0 bytes isn't what caller wants since | ||
910 | * get_order(0) returns funny result. Just warn and terminate | ||
911 | * early. | ||
912 | */ | ||
913 | return NULL; | ||
914 | } | ||
907 | order = get_order(size); | 915 | order = get_order(size); |
908 | 916 | ||
909 | again: | 917 | again: |