Skip to content

Commit

Permalink
SLUB: Deal with annoying gcc warning on kfree()
Browse files Browse the repository at this point in the history
gcc 4.2 spits out an annoying warning if one casts a const void *
pointer to a void * pointer. No warning is generated if the
conversion is done through an assignment.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
  • Loading branch information
Christoph Lameter authored and Christoph Lameter committed Feb 8, 2008
1 parent 0afc2ed commit 5bb983b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -2601,6 +2601,7 @@ EXPORT_SYMBOL(ksize);
void kfree(const void *x)
{
struct page *page;
void *object = (void *)x;

if (unlikely(ZERO_OR_NULL_PTR(x)))
return;
Expand All @@ -2610,7 +2611,7 @@ void kfree(const void *x)
put_page(page);
return;
}
slab_free(page->slab, page, (void *)x, __builtin_return_address(0));
slab_free(page->slab, page, object, __builtin_return_address(0));
}
EXPORT_SYMBOL(kfree);

Expand Down

0 comments on commit 5bb983b

Please sign in to comment.