linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] coda: return -EFAULT if copy fails
@ 2023-05-15  6:19 Su Hui
  2023-05-15  7:35 ` Dan Carpenter
  2023-05-15 17:15 ` Christophe JAILLET
  0 siblings, 2 replies; 5+ messages in thread
From: Su Hui @ 2023-05-15  6:19 UTC (permalink / raw)
  To: Jan Harkes, coda; +Cc: codalist, linux-kernel, kernel-janitors, Su Hui

The copy_to/from_user() functions should return -EFAULT instead of -EINVAL.

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;
 	}
 
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] coda: return -EFAULT if copy fails
  2023-05-15  6:19 [PATCH] coda: return -EFAULT if copy fails Su Hui
@ 2023-05-15  7:35 ` Dan Carpenter
  2023-05-16  1:35   ` Su Hui
  2023-05-15 17:15 ` Christophe JAILLET
  1 sibling, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2023-05-15  7:35 UTC (permalink / raw)
  To: Su Hui; +Cc: Jan Harkes, coda, codalist, linux-kernel, kernel-janitors

On Mon, May 15, 2023 at 02:19:23PM +0800, Su Hui wrote:
> The copy_to/from_user() functions should return -EFAULT instead of -EINVAL.
> 
> Signed-off-by: Su Hui <suhui@nfschina.com>
> ---

Could you add a Fixes tag?

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] coda: return -EFAULT if copy fails
  2023-05-15  6:19 [PATCH] coda: return -EFAULT if copy fails Su Hui
  2023-05-15  7:35 ` Dan Carpenter
@ 2023-05-15 17:15 ` Christophe JAILLET
  1 sibling, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2023-05-15 17:15 UTC (permalink / raw)
  To: Su Hui, Jan Harkes, coda; +Cc: codalist, linux-kernel, kernel-janitors

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

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;
>   	}
>   



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] coda: return -EFAULT if copy fails
  2023-05-15  7:35 ` Dan Carpenter
@ 2023-05-16  1:35   ` Su Hui
  0 siblings, 0 replies; 5+ messages in thread
From: Su Hui @ 2023-05-16  1:35 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Jan Harkes, coda, codalist, linux-kernel, kernel-janitors

On 2023/5/15 15:35, Dan Carpenter wrote:
> On Mon, May 15, 2023 at 02:19:23PM +0800, Su Hui wrote:
>> The copy_to/from_user() functions should return -EFAULT instead of -EINVAL.
>>
>> Signed-off-by: Su Hui <suhui@nfschina.com>
>> ---
> Could you add a Fixes tag?

Hi,

This doesn't seem like a bug.

So I think Fixes tag should not be used here.

Thanks for your reply!

Su Hui

> regards,
> dan carpenter
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] coda: return -EFAULT if copy fails
       [not found] <574ad370-cb3a-76db-ca8f-4203d42cc0fc@nfschina.com>
@ 2023-05-16  1:17 ` Su Hui
  0 siblings, 0 replies; 5+ messages in thread
From: Su Hui @ 2023-05-16  1:17 UTC (permalink / raw)
  To: Christophe JAILLET, Jan Harkes, coda
  Cc: codalist, linux-kernel, kernel-janitors


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;
>>       }
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-05-16  1:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-15  6:19 [PATCH] coda: return -EFAULT if copy fails Su Hui
2023-05-15  7:35 ` Dan Carpenter
2023-05-16  1:35   ` Su Hui
2023-05-15 17:15 ` Christophe JAILLET
     [not found] <574ad370-cb3a-76db-ca8f-4203d42cc0fc@nfschina.com>
2023-05-16  1:17 ` Su Hui

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).