All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tiwei Bie" <tiwei.btw@antgroup.com>
To: Johannes Berg <johannes@sipsolutions.net>, linux-um@lists.infradead.org
Cc: Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCH 1/5] um: signal: move pid variable where needed
Date: Fri, 29 Mar 2024 12:20:14 +0800	[thread overview]
Message-ID: <57825fac-d4d1-4f8e-acb8-f2e8af95bd5c@antgroup.com> (raw)
In-Reply-To: <20240328100640.d3ffb37dc64b.I2e2e713d6a78ea24e6508db9d3ef2882b88861da@changeid>

On 3/28/24 5:06 PM, Johannes Berg wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> We have W=1 warnings on 64-bit because the pid is only
> used in branches on 32-bit; move it inside to get rid of
> the warnings.
> 
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> ---
>  arch/x86/um/signal.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/um/signal.c b/arch/x86/um/signal.c
> index 263e1d08f216..16ff097e790d 100644
> --- a/arch/x86/um/signal.c
> +++ b/arch/x86/um/signal.c
> @@ -155,7 +155,7 @@ static int copy_sc_from_user(struct pt_regs *regs,
>  			     struct sigcontext __user *from)
>  {
>  	struct sigcontext sc;
> -	int err, pid;
> +	int err;
>  
>  	/* Always make any pending restarted system calls return -EINTR */
>  	current->restart_block.fn = do_no_restart_syscall;
> @@ -201,10 +201,10 @@ static int copy_sc_from_user(struct pt_regs *regs,
>  
>  #undef GETREG
>  
> -	pid = userspace_pid[current_thread_info()->cpu];
>  #ifdef CONFIG_X86_32
>  	if (have_fpx_regs) {
>  		struct user_fxsr_struct fpx;
> +		int pid = userspace_pid[current_thread_info()->cpu];

Tiny nit: might be better to move it before "struct user_fxsr_struct fpx;".
And it will be more consistent with the other change in this patch. :)

>  
>  		err = copy_from_user(&fpx,
>  			&((struct _fpstate __user *)sc.fpstate)->_fxsr_env[0],
> @@ -240,7 +240,7 @@ static int copy_sc_to_user(struct sigcontext __user *to,
>  {
>  	struct sigcontext sc;
>  	struct faultinfo * fi = &current->thread.arch.faultinfo;
> -	int err, pid;
> +	int err;
>  	memset(&sc, 0, sizeof(struct sigcontext));
>  
>  #define PUTREG(regno, regname) sc.regname = regs->regs.gp[HOST_##regno]
> @@ -288,10 +288,9 @@ static int copy_sc_to_user(struct sigcontext __user *to,
>  	if (err)
>  		return 1;
>  
> -	pid = userspace_pid[current_thread_info()->cpu];
> -
>  #ifdef CONFIG_X86_32
>  	if (have_fpx_regs) {
> +		int pid = userspace_pid[current_thread_info()->cpu];
>  		struct user_fxsr_struct fpx;
>  
>  		err = save_fpx_registers(pid, (unsigned long *) &fpx);

For the series, feel free to add my Reviewed-by: Tiwei Bie <tiwei.btw@antgroup.com>

Regards,
Tiwei


      parent reply	other threads:[~2024-03-29  4:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28  9:06 [PATCH 1/5] um: signal: move pid variable where needed Johannes Berg
2024-03-28  9:06 ` [PATCH 2/5] um: slirp: remove set but unused variable 'pid' Johannes Berg
2024-03-28  9:06 ` [PATCH 3/5] um: vector: fix bpfflash parameter evaluation Johannes Berg
2024-03-28  9:06 ` [PATCH 4/5] um: vector: remove unused len variable/calculation Johannes Berg
2024-03-28  9:06 ` [PATCH 5/5] um: process: remove unused 'n' variable Johannes Berg
2024-03-29  4:20 ` Tiwei Bie [this message]

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=57825fac-d4d1-4f8e-acb8-f2e8af95bd5c@antgroup.com \
    --to=tiwei.btw@antgroup.com \
    --cc=johannes.berg@intel.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-um@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.