From: Su Hui <suhui@nfschina.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
Jan Harkes <jaharkes@cs.cmu.edu>,
coda@cs.cmu.edu
Cc: codalist@coda.cs.cmu.edu, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] coda: return -EFAULT if copy fails
Date: Tue, 16 May 2023 09:17:53 +0800 [thread overview]
Message-ID: <0325060c-0a0a-0754-2d3e-1cadea9b6660@nfschina.com> (raw)
In-Reply-To: <574ad370-cb3a-76db-ca8f-4203d42cc0fc@nfschina.com>
On 2023/5/16 01:15, Christophe JAILLET wrote:
> Le 15/05/2023 à 08:19, Su Hui a écrit :
>> The copy_to/from_user() functions should return -EFAULT instead of
>> -EINVAL.
>
> Hi,
>
> just for my understanding, why?
>
> Even if not perfect:
> git grep -A1 copy_from_user | grep EINV | wc -l
> 15
>
> git grep -A1 copy_to_user | grep EINV | wc -l
> 12
>
Hi,
maybe return -EFAULT is more better than -EINVAL.
git grep -A1 "copy_from_user" | grep EFAULT | wc -l
1985
git grep -A1 "copy_to_user" | grep EFAULT | wc -l
1871
Su Hui
> CJ
>
>>
>> Signed-off-by: Su Hui <suhui@nfschina.com>
>> ---
>> fs/coda/upcall.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c
>> index cd6a3721f6f6..1517dc3bd592 100644
>> --- a/fs/coda/upcall.c
>> +++ b/fs/coda/upcall.c
>> @@ -510,7 +510,7 @@ int venus_pioctl(struct super_block *sb, struct
>> CodaFid *fid,
>> /* get the data out of user space */
>> if (copy_from_user((char *)inp + (long)inp->coda_ioctl.data,
>> data->vi.in, data->vi.in_size)) {
>> - error = -EINVAL;
>> + error = -EFAULT;
>> goto exit;
>> }
>
>
next parent reply other threads:[~2023-05-16 1:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <574ad370-cb3a-76db-ca8f-4203d42cc0fc@nfschina.com>
2023-05-16 1:17 ` Su Hui [this message]
2023-05-15 6:19 Su Hui
2023-05-15 7:35 ` Dan Carpenter
2023-05-16 1:35 ` Su Hui
2023-05-15 17:15 ` Christophe JAILLET
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=0325060c-0a0a-0754-2d3e-1cadea9b6660@nfschina.com \
--to=suhui@nfschina.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=coda@cs.cmu.edu \
--cc=codalist@coda.cs.cmu.edu \
--cc=jaharkes@cs.cmu.edu \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®