Skip to content

Commit

Permalink
[PATCH] slab: remove broken PageSlab check from kfree_debugcheck
Browse files Browse the repository at this point in the history
The PageSlab debug check in kfree_debugcheck() is broken for compound
pages.  It is also redundant as we already do BUG_ON for non-slab pages in
page_get_cache() and page_get_slab() which are always called before we free
any actual objects.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Pekka Enberg authored and Linus Torvalds committed Feb 11, 2007
1 parent 66efc5a commit 6e40e73
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -2814,19 +2814,11 @@ static int cache_grow(struct kmem_cache *cachep,
*/
static void kfree_debugcheck(const void *objp)
{
struct page *page;

if (!virt_addr_valid(objp)) {
printk(KERN_ERR "kfree_debugcheck: out of range ptr %lxh.\n",
(unsigned long)objp);
BUG();
}
page = virt_to_page(objp);
if (!PageSlab(page)) {
printk(KERN_ERR "kfree_debugcheck: bad ptr %lxh.\n",
(unsigned long)objp);
BUG();
}
}

static inline void verify_redzone_free(struct kmem_cache *cache, void *obj)
Expand Down

0 comments on commit 6e40e73

Please sign in to comment.