public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Borislav Petkov <bp@alien8.de>
Cc: Qian Cai <cai@lca.pw>,
	mingo@redhat.com, tglx@linutronix.de,
	dave.hansen@linux.intel.com, luto@kernel.org,
	peterz@infradead.org, hpa@zytor.com, x86@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] x86/mm: fix an unused variable "tsk" warning
Date: Wed, 12 Jun 2019 13:19:06 -0500	[thread overview]
Message-ID: <87a7emy8dh.fsf@xmission.com> (raw)
In-Reply-To: <20190612175543.GO32652@zn.tnic> (Borislav Petkov's message of "Wed, 12 Jun 2019 19:55:43 +0200")

Borislav Petkov <bp@alien8.de> writes:

> On Fri, May 31, 2019 at 05:37:21PM -0400, Qian Cai wrote:
>> 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 <cai@lca.pw>
>> ---
>>  arch/x86/mm/fault.c | 8 +++-----
>>  1 file changed, 3 insertions(+), 5 deletions(-)
>> 
>> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
>> index 46ac96aa7c81..40d70bd3fa84 100644
>> --- a/arch/x86/mm/fault.c
>> +++ b/arch/x86/mm/fault.c
>> @@ -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);
>>  }
>>  
>> -- 
>
> 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 <ebiederm@xmission.com>
> Date:   Mon Jun 3 10:23:58 2019 -0500
>
>     signal/x86: Move tsk inside of CONFIG_MEMORY_FAILURE in do_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

  reply	other threads:[~2019-06-12 18:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31 21:37 [PATCH -next] x86/mm: fix an unused variable "tsk" warning Qian Cai
2019-06-12 17:55 ` Borislav Petkov
2019-06-12 18:19   ` Eric W. Biederman [this message]
2019-06-12 19:53     ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87a7emy8dh.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=bp@alien8.de \
    --cc=cai@lca.pw \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox