KEYS: Implement asymmetric key type
[firefly-linux-kernel-4.4.55.git] / mm / vmalloc.c
index 7e25ee3ce6e5485649ba96f027b184357a2919f8..2bb90b1d241cc872da1e13dd80b449b2d323e812 100644 (file)
@@ -904,6 +904,14 @@ static void *vb_alloc(unsigned long size, gfp_t gfp_mask)
 
        BUG_ON(size & ~PAGE_MASK);
        BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC);
+       if (WARN_ON(size == 0)) {
+               /*
+                * Allocating 0 bytes isn't what caller wants since
+                * get_order(0) returns funny result. Just warn and terminate
+                * early.
+                */
+               return NULL;
+       }
        order = get_order(size);
 
 again: