diff options
author | Christoph Lameter <clameter@sgi.com> | 2007-05-09 05:32:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-09 15:30:44 -0400 |
commit | abcd08a6f564171ffa05bc77d1c2ba4cfa949653 (patch) | |
tree | 10760411326e881329851707e93aebd8c6782737 /mm/slub.c | |
parent | a87615b8f9e2349f6d3770af3d72fd6a41ab4239 (diff) |
SLUB: use check_valid_pointer in kmem_ptr_validate
We needlessly duplicate code. Also make check_valid_pointer inline.
Signed-off-by: Christoph LAemter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/slub.c')
-rw-r--r-- | mm/slub.c | 13 |
1 files changed, 3 insertions, 10 deletions
@@ -405,9 +405,8 @@ static int check_bytes(u8 *start, unsigned int value, unsigned int bytes) | |||
405 | return 1; | 405 | return 1; |
406 | } | 406 | } |
407 | 407 | ||
408 | 408 | static inline int check_valid_pointer(struct kmem_cache *s, | |
409 | static int check_valid_pointer(struct kmem_cache *s, struct page *page, | 409 | struct page *page, const void *object) |
410 | void *object) | ||
411 | { | 410 | { |
412 | void *base; | 411 | void *base; |
413 | 412 | ||
@@ -1796,13 +1795,7 @@ int kmem_ptr_validate(struct kmem_cache *s, const void *object) | |||
1796 | /* No slab or wrong slab */ | 1795 | /* No slab or wrong slab */ |
1797 | return 0; | 1796 | return 0; |
1798 | 1797 | ||
1799 | addr = page_address(page); | 1798 | if (!check_valid_pointer(s, page, object)) |
1800 | if (object < addr || object >= addr + s->objects * s->size) | ||
1801 | /* Out of bounds */ | ||
1802 | return 0; | ||
1803 | |||
1804 | if ((object - addr) % s->size) | ||
1805 | /* Improperly aligned */ | ||
1806 | return 0; | 1799 | return 0; |
1807 | 1800 | ||
1808 | /* | 1801 | /* |