public inbox for linux-edac@vger.kernel.org
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Miaohe Lin <linmiaohe@huawei.com>
Cc: tony.luck@intel.com, bp@alien8.de, tglx@linutronix.de,
	mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com,
	x86@kernel.org, linux-edac@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/mce: remove unused mce_vaddr
Date: Tue, 30 May 2023 12:16:29 -0700	[thread overview]
Message-ID: <ZHZLjRPSYCOYjkBo@aschofie-mobl2> (raw)
In-Reply-To: <20230528113545.650533-1-linmiaohe@huawei.com>

On Sun, May 28, 2023 at 07:35:45PM +0800, Miaohe Lin wrote:
> Since commit a6e3cf70b772 ("x86/mce: Change to not send SIGBUS error during
> copy from user"), mce_vaddr is not used anymore. Remove it and clean up the
> relevant code.

Hi Miaohe,

Not so sure that the 'clean up' part is useful. See below.


> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  arch/x86/kernel/cpu/mce/severity.c | 7 +------
>  include/linux/sched.h              | 1 -
>  2 files changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c
> index c4477162c07d..0acc0039de81 100644
> --- a/arch/x86/kernel/cpu/mce/severity.c
> +++ b/arch/x86/kernel/cpu/mce/severity.c
> @@ -252,12 +252,7 @@ static bool is_copy_from_user(struct pt_regs *regs)
>  		return false;
>  	}
>  
> -	if (fault_in_kernel_space(addr))
> -		return false;
> -
> -	current->mce_vaddr = (void __user *)addr;
> -
> -	return true;
> +	return !fault_in_kernel_space(addr);
>  }


Refactoring the return is unnecessary and seems less readable.
How about removing the assignment, and leaving the rest, as is:

diff --git a/arch/x86/kernel/cpu/mce/severity.c b/arch/x86/kernel/cpu/mce/severity.c
index c4477162c07d..1c03221ddcb1 100644
--- a/arch/x86/kernel/cpu/mce/severity.c
+++ b/arch/x86/kernel/cpu/mce/severity.c
@@ -255,8 +255,6 @@ static bool is_copy_from_user(struct pt_regs *regs)
        if (fault_in_kernel_space(addr))
                return false;
 
-       current->mce_vaddr = (void __user *)addr;
-
        return true;
 }


Alison




>  
>  /*
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index eed5d65b8d1f..3054a7087230 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -1493,7 +1493,6 @@ struct task_struct {
>  #endif
>  
>  #ifdef CONFIG_X86_MCE
> -	void __user			*mce_vaddr;
>  	__u64				mce_kflags;
>  	u64				mce_addr;
>  	__u64				mce_ripv : 1,
> -- 
> 2.27.0
> 

  reply	other threads:[~2023-05-30 19:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-28 11:35 [PATCH] x86/mce: remove unused mce_vaddr Miaohe Lin
2023-05-30 19:16 ` Alison Schofield [this message]
2023-06-03  3:17   ` Miaohe Lin

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=ZHZLjRPSYCOYjkBo@aschofie-mobl2 \
    --to=alison.schofield@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --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