Skip to content

Commit fcae96f

Browse files
thejhtorvalds
authored andcommitted
mm: fix vm_fault_t cast in VM_FAULT_GET_HINDEX()
Symmetrically to VM_FAULT_SET_HINDEX(), we need a force-cast in VM_FAULT_GET_HINDEX() to tell sparse that this is intentional. Sparse complains about the current code when building a kernel with CONFIG_MEMORY_FAILURE: arch/x86/mm/fault.c:1058:53: warning: restricted vm_fault_t degrades to integer Link: http://lkml.kernel.org/r/20190327204117.35215-1-jannh@google.com Fixes: 3d35390 ("mm: create the new vm_fault_t type") Signed-off-by: Jann Horn <jannh@google.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Souptick Joarder <jrdr.linux@gmail.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> Cc: Rik van Riel <riel@surriel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent b11ed18 commit fcae96f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/linux/mm_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ enum vm_fault_reason {
671671

672672
/* Encode hstate index for a hwpoisoned large page */
673673
#define VM_FAULT_SET_HINDEX(x) ((__force vm_fault_t)((x) << 16))
674-
#define VM_FAULT_GET_HINDEX(x) (((x) >> 16) & 0xf)
674+
#define VM_FAULT_GET_HINDEX(x) (((__force unsigned int)(x) >> 16) & 0xf)
675675

676676
#define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | \
677677
VM_FAULT_SIGSEGV | VM_FAULT_HWPOISON | \

0 commit comments

Comments
 (0)