summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-05-26 19:21:26 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-26 19:21:26 +0200
commit1434b65731963207a4cc84bd87e6191e34321986 (patch)
tree07f58551b451675c2f85ebe88e5feb8971577d78 /mm
parentMerge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6.26 (diff)
parentslub: ksize() abuse checks (diff)
downloadlinux-1434b65731963207a4cc84bd87e6191e34321986.tar.xz
linux-1434b65731963207a4cc84bd87e6191e34321986.zip
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
Diffstat (limited to 'mm')
-rw-r--r--mm/slob.c5
-rw-r--r--mm/slub.c5
2 files changed, 6 insertions, 4 deletions
diff --git a/mm/slob.c b/mm/slob.c
index 6038cbadf796..a3ad6671adf1 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -469,8 +469,9 @@ void *__kmalloc_node(size_t size, gfp_t gfp, int node)
return ZERO_SIZE_PTR;
m = slob_alloc(size + align, gfp, align, node);
- if (m)
- *m = size;
+ if (!m)
+ return NULL;
+ *m = size;
return (void *)m + align;
} else {
void *ret;
diff --git a/mm/slub.c b/mm/slub.c
index a505a828ef41..0987d1cd943c 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2726,9 +2726,10 @@ size_t ksize(const void *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);
-
+ }
s = page->slab;
#ifdef CONFIG_SLUB_DEBUG