mm: mprotect: use VM_ACCESS_FLAGS
authorKefeng Wang <wangkefeng.wang@huawei.com>
Wed, 19 Oct 2022 03:49:43 +0000 (11:49 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 9 Nov 2022 01:37:19 +0000 (17:37 -0800)
Simplify VM_READ|VM_WRITE|VM_EXEC with VM_ACCESS_FLAGS.

Link: https://lkml.kernel.org/r/20221019034945.93081-4-wangkefeng.wang@huawei.com
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Airlie <airlied@gmail.com>
Cc: Dinh Nguyen <dinguyen@kernel.org>
Cc: Jarkko Sakkinen <jarkko@kernel.org>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/mprotect.c

index 668bfaa6ed2aebdbc64182e7d2c8a007a2d4bae7..99762403cc8ff6aa3b50f788c62e87b526c7a760 100644 (file)
@@ -756,8 +756,7 @@ static int do_mprotect_pkey(unsigned long start, size_t len,
                 * If a permission is not passed to mprotect(), it must be
                 * cleared from the VMA.
                 */
-               mask_off_old_flags = VM_READ | VM_WRITE | VM_EXEC |
-                                       VM_FLAGS_CLEAR;
+               mask_off_old_flags = VM_ACCESS_FLAGS | VM_FLAGS_CLEAR;
 
                new_vma_pkey = arch_override_mprotect_pkey(vma, prot, pkey);
                newflags = calc_vm_prot_bits(prot, new_vma_pkey);