Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 76994412 authored by Pekka Enberg's avatar Pekka Enberg
Browse files

slub: ksize() abuse checks



Add a WARN_ON for pages that don't have PageSlab nor PageCompound set to catch
the worst abusers of ksize() in the kernel.

Acked-by: default avatarChristoph Lameter <clameter@sgi.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
parent 239f49c0
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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