x86/mm: fix an unused variable "tsk" warning
PATCH 1/1 x86/mm: fix an unused variable "tsk" warning
Since the commit "signal: Remove the task parameter from force_sig_fault", "tsk" is only used when MEMORY_FAILURE=y and generates a compilation warning without it.
arch/x86/mm/fault.c: In function 'do_sigbus':arch/x86/mm/fault.c:1017:22: warning: unused variable 'tsk' [-Wunused-variable]
Also, change to use IS_ENABLED() instead.
--- arch/x86/mm/fault.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
arch/x86/mm/fault.c +3 -5
@@ -1014,8 +1014,6 @@ 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) { - struct task_struct *tsk = current; - /* Kernel mode? Handle exceptions or die: */ if (!(error_code & X86_PF_USER)) { no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);
@@ -1028,9 +1026,10 @@ static inline bool bad_area_access_from_pkeys(unsigned long error_code,set_signal_archinfo (address, error_code); -#ifdef CONFIG_MEMORY_FAILURE -if (fault & (VM_FAULT_HWPOISON |VM_FAULT_HWPOISON_LARGE )) { +if (IS_ENABLED (CONFIG_MEMORY_FAILURE ) && + (fault & (VM_FAULT_HWPOISON |VM_FAULT_HWPOISON_LARGE ))) {unsigned lsb =0 ; +struct task_struct *tsk = current; pr_err( "MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n",
@@ -1042,7 +1041,6 @@ static inline bool bad_area_access_from_pkeys(unsigned long error_code,force_sig_mceerr (BUS_MCEERR_AR , (void __user *)address, lsb);return ; } -#endif force_sig_fault (SIGBUS ,BUS_ADRERR , (void __user *)address); }
Signature · 1 line
1.8.3.1
Borislav Petkov
maintainerQuoted 43 lines · Qian Cai
Since the commit "signal: Remove the task parameter from
force_sig_fault", "tsk" is only used when MEMORY_FAILURE=y and generates a compilation warning without it.
arch/x86/mm/fault.c: In function 'do_sigbus':arch/x86/mm/fault.c:1017:22: warning: unused variable 'tsk' [-Wunused-variable]Also, change to use
IS_ENABLED()instead.Signed-off-by Qian Cai <[email protected]>--- arch/x86/mm/fault.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)arch/x86/mm/fault.c +3
-4@@ -1014,8 +1014,6 @@ 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) { - struct task_struct *tsk = current; - /* Kernel mode? Handle exceptions or die: */ if (!(error_code & X86_PF_USER)) { no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);@@ -1028,9 +1026,10 @@ static inline bool bad_area_access_from_pkeys(unsigned long error_code,set_signal_archinfo (address, error_code); -#ifdef CONFIG_MEMORY_FAILURE -if (fault & (VM_FAULT_HWPOISON |VM_FAULT_HWPOISON_LARGE )) { +if (IS_ENABLED (CONFIG_MEMORY_FAILURE ) && + (fault & (VM_FAULT_HWPOISON |VM_FAULT_HWPOISON_LARGE ))) {unsigned lsb =0 ; +struct task_struct *tsk = current; pr_err( "MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n",
arch/x86/mm/fault.c static inline bool bad_area_access_from_pkeys(unsigned long error_code, · line 1046
Quoted 7 lines
arch/x86/mm/fault.c +0
-1@@ -1042,7 +1041,6 @@ static inline bool bad_area_access_from_pkeys(unsigned long error_code,force_sig_mceerr (BUS_MCEERR_AR , (void __user *)address, lsb);return ; } -#endif force_sig_fault (SIGBUS ,BUS_ADRERR , (void __user *)address); }
I was puzzled just like Dave because this code is not in tip.
Turns out there's this in linux-next:
commit 318759b4737c3b3789e2fd64d539f437d52386f5
Author: Eric W. Biederman <[email protected]> Date: Mon Jun 3 10:23:58 2019 -0500
signal/x86: Move tsk inside of CONFIG_MEMORY_FAILURE in do_sigbus
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.Quoted 54 lines · Borislav Petkov
Quoted 43 lines · Qian Cai
Since the commit "signal: Remove the task parameter from
force_sig_fault", "tsk" is only used when MEMORY_FAILURE=y and generates a compilation warning without it.
arch/x86/mm/fault.c: In function 'do_sigbus':arch/x86/mm/fault.c:1017:22: warning: unused variable 'tsk' [-Wunused-variable]Also, change to use
IS_ENABLED()instead.Signed-off-by Qian Cai <[email protected]>--- arch/x86/mm/fault.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)arch/x86/mm/fault.c +3
-4@@ -1014,8 +1014,6 @@ 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) { - struct task_struct *tsk = current; - /* Kernel mode? Handle exceptions or die: */ if (!(error_code & X86_PF_USER)) { no_context(regs, error_code, address, SIGBUS, BUS_ADRERR);@@ -1028,9 +1026,10 @@ static inline bool bad_area_access_from_pkeys(unsigned long error_code,set_signal_archinfo (address, error_code); -#ifdef CONFIG_MEMORY_FAILURE -if (fault & (VM_FAULT_HWPOISON |VM_FAULT_HWPOISON_LARGE )) { +if (IS_ENABLED (CONFIG_MEMORY_FAILURE ) && + (fault & (VM_FAULT_HWPOISON |VM_FAULT_HWPOISON_LARGE ))) {unsigned lsb =0 ; +struct task_struct *tsk = current; pr_err( "MCE: Killing %s:%d due to hardware memory corruption fault at %lx\n",arch/x86/mm/fault.c static inline bool bad_area_access_from_pkeys(unsigned long error_code, · line 1046
Quoted 7 lines
arch/x86/mm/fault.c +0
-1@@ -1042,7 +1041,6 @@ static inline bool bad_area_access_from_pkeys(unsigned long error_code,force_sig_mceerr (BUS_MCEERR_AR , (void __user *)address, lsb);return ; } -#endif force_sig_fault (SIGBUS ,BUS_ADRERR , (void __user *)address); }I was puzzled just like Dave because this code is not in tip.
Quoted 7 lines
Turns out there's this in linux-next:
commit
318759b4737c3b3789e2fd64d539f437d52386f5Author: Eric W. Biederman <[email protected]> Date: Mon Jun 3 10:23:58 2019 -0500signal/x86: Move tsk inside of
CONFIG_MEMORY_FAILUREindo_sigbus
Since I am removing the tsk parameter from all of the synchrnous signal sending functions, on all of the architectures it was easier to go through my own tree than -tip.
The removal of tsk from force_sig_fault is what caused the warning in do_sigbus.
My apologies I was a little slow in getting that patch added and generating work for other folks.
Eric
Borislav Petkov
maintainerQuoted 3 lines · Eric W. Biederman
Since I am removing the tsk parameter from all of the synchrnous signal sending functions, on all of the architectures it was easier to go through my own tree than -tip.
Yeah, I remember reading a mail about it...
Quoted 5 lines
The removal of tsk from
force_sig_faultis what caused the warning indo_sigbus.My apologies I was a little slow in getting that patch added and generating work for other folks.
That's fine - now we know what the situation is.
Thx.
Signature · 4 lines
Regards/Gruss,
Boris.
Good mailing practices for 400: avoid top-posting and trim the reply.