From: Sergei Shtylyov <sergei.shtylyov@gmail.com>
To: Wang Qing <wangqing@vivo.com>,
Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arch: mips: sibyte: Return -EFAULT if copy_to_user() fails
Date: Mon, 1 Mar 2021 11:53:01 +0300 [thread overview]
Message-ID: <3a7d2007-b7d2-e428-406c-a6804bff6df0@gmail.com> (raw)
In-Reply-To: <1614580437-19660-1-git-send-email-wangqing@vivo.com>
Hello!
On 01.03.2021 9:33, 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.
Then 'err' is hardly a good name for that variable. :-)
>
> Signed-off-by: Wang Qing <wangqing@vivo.com>
> ---
> arch/mips/sibyte/common/sb_tbprof.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/sibyte/common/sb_tbprof.c b/arch/mips/sibyte/common/sb_tbprof.c
> index f80d7a7..eac125f
> --- a/arch/mips/sibyte/common/sb_tbprof.c
> +++ b/arch/mips/sibyte/common/sb_tbprof.c
> @@ -465,7 +465,7 @@ static ssize_t sbprof_tb_read(struct file *filp, char *buf,
> if (err) {
> *offp = cur_off + cur_count - err;
> mutex_unlock(&sbp.lock);
> - return err;
> + return -EFAULT;
> }
> pr_debug(DEVNAME ": read from sample %d, %d bytes\n",
> cur_sample, cur_count);
MBR, Sergei
next prev parent reply other threads:[~2021-03-01 8:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-01 6:33 [PATCH] arch: mips: sibyte: Return -EFAULT if copy_to_user() fails Wang Qing
2021-03-01 8:53 ` Sergei Shtylyov [this message]
2021-03-01 22:01 ` Maciej W. Rozycki
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=3a7d2007-b7d2-e428-406c-a6804bff6df0@gmail.com \
--to=sergei.shtylyov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=tsbogend@alpha.franken.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