提交 f0b615be 编写于 作者: F Fang Lijun 提交者: Yang Yingliang

arm64/ascend: mm: Fix arm32 compile warnings

ascend inclusion
category: bugfix
bugzilla: NA
CVE: NA

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

The vm_flags will overflow on arm32 as left shift CHECKNODE_BITS(48).

This checknode function only used in cdm feature.

Fixes: cdccf4d4b7b5 ("arm64/ascend: mm: Add MAP_CHECKNODE flag to check node hugetlb")
Signed-off-by: NFang Lijun <fanglijun3@huawei.com>
Reviewed-by: NDing Tianhong <dingtianhong@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 0ab1a676
...@@ -15,9 +15,6 @@ struct ctl_table; ...@@ -15,9 +15,6 @@ struct ctl_table;
struct user_struct; struct user_struct;
struct mmu_gather; struct mmu_gather;
#define CHECKNODE_BITS 48
#define CHECKNODE_MASK (~((_AC(1, UL) << CHECKNODE_BITS) - 1))
#ifndef is_hugepd #ifndef is_hugepd
/* /*
* Some architectures requires a hugepage directory format that is * Some architectures requires a hugepage directory format that is
......
...@@ -73,6 +73,20 @@ static inline int dvpp_mmap_zone(unsigned long addr) { return 0; } ...@@ -73,6 +73,20 @@ static inline int dvpp_mmap_zone(unsigned long addr) { return 0; }
#endif #endif
#ifdef CONFIG_COHERENT_DEVICE
#define CHECKNODE_BITS 48
#define CHECKNODE_MASK (~((_AC(1, UL) << CHECKNODE_BITS) - 1))
static inline void set_vm_checknode(vm_flags_t vm_flags, unsigned long flags)
{
if (is_set_cdmmask())
vm_flags |= VM_CHECKNODE | ((((flags >> MAP_HUGE_SHIFT) &
MAP_HUGE_MASK) << CHECKNODE_BITS) & CHECKNODE_MASK);
}
#else
#define CHECKNODE_BITS (0)
static inline void set_vm_checknode(vm_flags_t vm_flags, unsigned long flags) {}
#endif
/* /*
* Arrange for legacy / undefined architecture specific flags to be * Arrange for legacy / undefined architecture specific flags to be
* ignored by mmap handling code. * ignored by mmap handling code.
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/swap.h> #include <linux/swap.h>
#include <linux/swapops.h> #include <linux/swapops.h>
#include <linux/jhash.h> #include <linux/jhash.h>
#include <linux/mman.h>
#include <asm/page.h> #include <asm/page.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
......
...@@ -1564,9 +1564,8 @@ unsigned long do_mmap(struct file *file, unsigned long addr, ...@@ -1564,9 +1564,8 @@ unsigned long do_mmap(struct file *file, unsigned long addr,
/* set numa node id into vm_flags, /* set numa node id into vm_flags,
* hugetlbfs file mmap will use it to check node * hugetlbfs file mmap will use it to check node
*/ */
if (is_set_cdmmask() && (flags & MAP_CHECKNODE)) if (flags & MAP_CHECKNODE)
vm_flags |= VM_CHECKNODE | ((((flags >> MAP_HUGE_SHIFT) & MAP_HUGE_MASK) set_vm_checknode(vm_flags, flags);
<< CHECKNODE_BITS) & CHECKNODE_MASK);
addr = mmap_region(file, addr, len, vm_flags, pgoff, uf); addr = mmap_region(file, addr, len, vm_flags, pgoff, uf);
if (!IS_ERR_VALUE(addr) && if (!IS_ERR_VALUE(addr) &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册