]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] Fix strange size check in __get_vm_area_node()
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Thu, 16 Nov 2006 09:19:29 +0000 (01:19 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Thu, 16 Nov 2006 19:43:38 +0000 (11:43 -0800)
Recently, __get_vm_area_node() was changed like following

  if (unlikely(!area))
  return NULL;

- if (unlikely(!size)) {
- kfree (area);
+ if (unlikely(!size))
  return NULL;
- }

It is leaking `area', also original code seems strange already.
Probably, we wanted to do this patch.

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
mm/vmalloc.c

index 7dc6aa745166cf680092103195e725619c4ce633..86897ee792d6b4a2f8e00a94cf4b12e2c1d6f075 100644 (file)
@@ -181,14 +181,13 @@ static struct vm_struct *__get_vm_area_node(unsigned long size, unsigned long fl
        }
        addr = ALIGN(start, align);
        size = PAGE_ALIGN(size);
+       if (unlikely(!size))
+               return NULL;
 
        area = kmalloc_node(sizeof(*area), gfp_mask & GFP_LEVEL_MASK, node);
        if (unlikely(!area))
                return NULL;
 
-       if (unlikely(!size))
-               return NULL;
-
        /*
         * We always allocate a guard page.
         */