提交 c513c045 编写于 作者: M Ma Wupeng 提交者: Yang Yingliang

mm: Check page status in page_reliable()

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I4SK3S
CVE: NA

--------------------------------

Check whether page is NULL or not in page_reliable(). Return false if page
is NULL.
Signed-off-by: NMa Wupeng <mawupeng1@huawei.com>
Reviewed-by: Kefeng Wang<wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 a4aa61b9
......@@ -107,7 +107,7 @@ static inline void shmem_reliable_page_counter(struct page *page, int nr_page)
static inline void mem_reliable_buddy_counter(struct page *page, int nr_page)
{
if (page && page_reliable(page))
if (page_reliable(page))
this_cpu_add(nr_reliable_buddy_pages, nr_page);
}
......
......@@ -53,12 +53,15 @@ void add_reliable_mem_size(long sz)
bool page_reliable(struct page *page)
{
return mem_reliable_is_enabled() && page_zonenum(page) < ZONE_MOVABLE;
if (!mem_reliable_is_enabled() || !page)
return false;
return page_zonenum(page) < ZONE_MOVABLE;
}
static bool reliable_and_lru_check(enum lru_list lru, struct page *page)
{
if (!page || !page_reliable(page))
if (!page_reliable(page))
return false;
if (lru != LRU_ACTIVE_FILE && lru != LRU_INACTIVE_FILE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册