History

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

Jann Horn committed 7 years ago

Commit fcae96f1 parent b11ed181 file · +1 −1Browse files

Unified · Split

include/linux/mm_types.h+1−1
@@ -671,7 +671,7 @@ enum vm_fault_reason { · 670 unmodified lines
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 | \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t