From: Vineet Gupta <vgupta@synopsys.com>
To: Wang Qing <wangqing@vivo.com>, Jens Axboe <axboe@kernel.dk>,
Thomas Gleixner <tglx@linutronix.de>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arc: kernel: Return -EFAULT if copy_to_user() fails
Date: Tue, 2 Mar 2021 11:01:11 -0800 [thread overview]
Message-ID: <bed81c02-97e0-9905-0dd3-6064a54691ff@synopsys.com> (raw)
In-Reply-To: <1614600349-15662-1-git-send-email-wangqing@vivo.com>
On 3/1/21 4:05 AM, Wang Qing wrote:
> The copy_to_user() function returns the number of bytes remaining to be
> copied, but we want to return -EFAULT if the copy doesn't complete.
>
> Signed-off-by: Wang Qing <wangqing@vivo.com>
Acked-by: Vineet Gupta <vgupta@synopsys.com>
Do you want me to pick this up via ARC tree ?
Thx,
-Vineet
> ---
> arch/arc/kernel/signal.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arc/kernel/signal.c b/arch/arc/kernel/signal.c
> index a78d8f7..fdbe06c
> --- a/arch/arc/kernel/signal.c
> +++ b/arch/arc/kernel/signal.c
> @@ -96,7 +96,7 @@ stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
> sizeof(sf->uc.uc_mcontext.regs.scratch));
> err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
>
> - return err;
> + return err ? -EFAULT : 0;
> }
>
> static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
> @@ -110,7 +110,7 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)
> &(sf->uc.uc_mcontext.regs.scratch),
> sizeof(sf->uc.uc_mcontext.regs.scratch));
> if (err)
> - return err;
> + return -EFAULT;
>
> set_current_blocked(&set);
> regs->bta = uregs.scratch.bta;
>
next prev parent reply other threads:[~2021-03-02 22:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-01 12:05 Wang Qing
2021-03-02 19:01 ` Vineet Gupta [this message]
2021-03-10 2:41 ` 王擎
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=bed81c02-97e0-9905-0dd3-6064a54691ff@synopsys.com \
--to=vgupta@synopsys.com \
--cc=axboe@kernel.dk \
--cc=gustavoars@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-snps-arc@lists.infradead.org \
--cc=tglx@linutronix.de \
--cc=wangqing@vivo.com \
/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
all inboxes | Powered by JetHome®