bug on cache_from_obj !PageSlab check

Signed-off-by: Daniel Micay <danielmicay@gmail.com>
Signed-off-by: anupritaisno1 <www.anuprita804@gmail.com>
This commit is contained in:
Daniel Micay 2017-05-03 11:38:54 -04:00 committed by Kreciorek
parent 8df273c856
commit c12b6fe5f1

View file

@ -478,9 +478,13 @@ static inline struct kmem_cache *virt_to_cache(const void *obj)
struct page *page; struct page *page;
page = virt_to_head_page(obj); page = virt_to_head_page(obj);
#ifdef CONFIG_BUG_ON_DATA_CORRUPTION
BUG_ON(!PageSlab(page));
#else
if (WARN_ONCE(!PageSlab(page), "%s: Object is not a Slab page!\n", if (WARN_ONCE(!PageSlab(page), "%s: Object is not a Slab page!\n",
__func__)) __func__))
return NULL; return NULL;
#endif
return page->slab_cache; return page->slab_cache;
} }