diff options
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 | /* |