x86/mm: fix an unused variable "tsk" warning
PATCH 1/1 x86/mm: fix an unused variable "tsk" warning
"tsk" is only used when MEMORY_FAILURE=y.
arch/x86/mm/fault.c: In function 'do_sigbus':arch/x86/mm/fault.c:1017:22: warning: unused variable 'tsk' [-Wunused-variable]
Signed-off-by Qian Cai <[email protected]>
--- arch/x86/mm/fault.c | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/mm/fault.c +2 -0
@@ -1015,7 +1015,9 @@ static inline bool bad_area_access_from_pkeys(unsigned long error_code, do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address, vm_fault_t fault) { +#ifdef CONFIG_MEMORY_FAILURE struct task_struct *tsk = current; +#endif /* Kernel mode? Handle exceptions or die: */ if (!(error_code &X86_PF_USER )) {
Signature · 1 line
1.8.3.1
arch/x86/mm/fault.c static inline bool bad_area_access_from_pkeys(unsigned long error_code, · line 1023
Quoted 12 lines · Qian Cai
arch/x86/mm/fault.c +2
-0@@ -1015,7 +1015,9 @@ static inline bool bad_area_access_from_pkeys(unsigned long error_code, do_sigbus(struct pt_regs *regs, unsigned long error_code, unsigned long address, vm_fault_t fault) { +#ifdef CONFIG_MEMORY_FAILURE struct task_struct *tsk = current; +#endif /* Kernel mode? Handle exceptions or die: */ if (!(error_code &X86_PF_USER )) {
Ick. I'd much rather see this:
#ifdef CONFIG_MEMORY_FAILURE
if (fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE)) {
unsigned lsb = 0;become:
if (IS_ENABLED(CONFIG_MEMORY_FAILURE) &&
(fault & (VM_FAULT_HWPOISON|VM_FAULT_HWPOISON_LARGE))) {
unsigned lsb = 0;than add another #ifdef.
BTW, which tree are you doing this against? Current -linus uses tsk in the last line of do_sigbus():
force_sig_fault(SIGBUS, BUS_ADRERR, ..., tsk);