diff options
-rw-r--r-- | mm/vmalloc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 7e25ee3ce6e5..2bb90b1d241c 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c | |||
@@ -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: |