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
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -671,7 +671,7 @@ enum vm_fault_reason { · 670 unmodified lines | |||
| 671 | 671 | ||
| 672 | /* Encode hstate index for a hwpoisoned large page */ | 672 | /* Encode hstate index for a hwpoisoned large page */ |
| 673 | #define VM_FAULT_SET_HINDEX(x) ((__force vm_fault_t)((x) << 16)) | 673 | #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) |
| 675 | 675 | ||
| 676 | #define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | \ | 676 | #define VM_FAULT_ERROR (VM_FAULT_OOM | VM_FAULT_SIGBUS | \ |
| 677 | VM_FAULT_SIGSEGV | VM_FAULT_HWPOISON | \ | 677 | VM_FAULT_SIGSEGV | VM_FAULT_HWPOISON | \ |