summaryrefslogtreecommitdiffstats
path: root/mm/slob.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-10-12 15:05:39 +0200
committerIngo Molnar <mingo@elte.hu>2008-10-12 15:05:39 +0200
commita9b9e81c915e4a57ac3b21d1a7fa7ff184639780 (patch)
tree98304395fbb5b9c74fca35b196cd414c1949f280 /mm/slob.c
parenta8b71a2810386a5ac8f43d2095fe3355f0d8db37 (diff)
parentfd048088306656824958e7783ffcee27e241b361 (diff)
downloadkernel-crypto-a9b9e81c915e4a57ac3b21d1a7fa7ff184639780.tar.gz
kernel-crypto-a9b9e81c915e4a57ac3b21d1a7fa7ff184639780.tar.xz
kernel-crypto-a9b9e81c915e4a57ac3b21d1a7fa7ff184639780.zip
Merge branch 'linus' into x86/memory-corruption-check
Diffstat (limited to 'mm/slob.c')
-rw-r--r--mm/slob.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mm/slob.c b/mm/slob.c
index 4c82dd41f32..cb675d12679 100644
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -514,9 +514,11 @@ size_t ksize(const void *block)
return 0;
sp = (struct slob_page *)virt_to_page(block);
- if (slob_page(sp))
- return ((slob_t *)block - 1)->units + SLOB_UNIT;
- else
+ if (slob_page(sp)) {
+ int align = max(ARCH_KMALLOC_MINALIGN, ARCH_SLAB_MINALIGN);
+ unsigned int *m = (unsigned int *)(block - align);
+ return SLOB_UNITS(*m) * SLOB_UNIT;
+ } else
return sp->page.private;
}