mm: prevent a warning when casting void* -> enum
authorPalmer Dabbelt <palmerdabbelt@google.com>
Tue, 7 Apr 2020 03:08:00 +0000 (20:08 -0700)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:24:03 +0000 (20:24 +0300)
I recently build the RISC-V port with LLVM trunk, which has introduced a
new warning when casting from a pointer to an enum of a smaller size.
This patch simply casts to a long in the middle to stop the warning.  I'd
be surprised this is the only one in the kernel, but it's the only one I
saw.

Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20200227211741.83165-1-palmer@dabbelt.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Change-Id: I91f127e3111aad48cbdfd2e63ab90f88047ddfca

mm/rmap.c

index 511853ed58d9eeb44a073cfede2af0f3f927545f..12d97f2bceaf6078d0c45ad4491b6687063c8acf 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1342,7 +1342,7 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
        struct page *subpage;
        bool ret = true;
        unsigned long start = address, end;
-       enum ttu_flags flags = (enum ttu_flags)arg;
+       enum ttu_flags flags = (enum ttu_flags)(long)arg;
 
        /*
         * When racing against e.g. zap_pte_range() on another cpu,