]> Pileus Git - ~andy/linux/blobdiff - mm/vmalloc.c
USB: serial: core: remove some trace debugging calls
[~andy/linux] / mm / vmalloc.c
index 65fc4dc711081501f3a89704c8cc8273a39ea6df..2bb90b1d241cc872da1e13dd80b449b2d323e812 100644 (file)
@@ -413,11 +413,11 @@ nocache:
                if (addr + size - 1 < addr)
                        goto overflow;
 
-               n = rb_next(&first->rb_node);
-               if (n)
-                       first = rb_entry(n, struct vmap_area, rb_node);
-               else
+               if (list_is_last(&first->list, &vmap_area_list))
                        goto found;
+
+               first = list_entry(first->list.next,
+                               struct vmap_area, list);
        }
 
 found:
@@ -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:
@@ -1983,9 +1991,7 @@ static int aligned_vwrite(char *buf, char *addr, unsigned long count)
  *     IOREMAP area is treated as memory hole and no copy is done.
  *
  *     If [addr...addr+count) doesn't includes any intersects with alive
- *     vm_struct area, returns 0.
- *     @buf should be kernel's buffer. Because this function uses KM_USER0,
- *     the caller should guarantee KM_USER0 is not used.
+ *     vm_struct area, returns 0. @buf should be kernel's buffer.
  *
  *     Note: In usual ops, vread() is never necessary because the caller
  *     should know vmalloc() area is valid and can use memcpy().
@@ -2059,9 +2065,7 @@ finished:
  *     IOREMAP area is treated as memory hole and no copy is done.
  *
  *     If [addr...addr+count) doesn't includes any intersects with alive
- *     vm_struct area, returns 0.
- *     @buf should be kernel's buffer. Because this function uses KM_USER0,
- *     the caller should guarantee KM_USER0 is not used.
+ *     vm_struct area, returns 0. @buf should be kernel's buffer.
  *
  *     Note: In usual ops, vwrite() is never necessary because the caller
  *     should know vmalloc() area is valid and can use memcpy().