Commit 1434b657 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg/slab-2.6:
  slub: ksize() abuse checks
  slob: Fix to return wrong pointer
parents 4934ed88 76994412
...@@ -469,8 +469,9 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node) ...@@ -469,8 +469,9 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
return ZERO_SIZE_PTR; return ZERO_SIZE_PTR;
m = slob_alloc(size + align, gfp, align, node); m = slob_alloc(size + align, gfp, align, node);
if (m) if (!m)
*m = size; return NULL;
*m = size;
return (void *)m + align; return (void *)m + align;
} else { } else {
void *ret; void *ret;
......
...@@ -2726,9 +2726,10 @@ size_t ksize(const void *object) ...@@ -2726,9 +2726,10 @@ size_t ksize(const void *object)
page = virt_to_head_page(object); page = virt_to_head_page(object);
if (unlikely(!PageSlab(page))) if (unlikely(!PageSlab(page))) {
WARN_ON(!PageCompound(page));
return PAGE_SIZE << compound_order(page); return PAGE_SIZE << compound_order(page);
}
s = page->slab; s = page->slab;
#ifdef CONFIG_SLUB_DEBUG #ifdef CONFIG_SLUB_DEBUG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment