lkml.org 
[lkml]   [2023]   [May]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] drivers/fsi/scom: Return -EFAULT if copy fails
Date
The copy_to/from_user() functions return the number of bytes remaining
to be copied, but we want to return -EFAULT to the user.

Fixes: 680ca6dcf5c2 ("drivers/fsi: Add SCOM FSI client device driver")
Signed-off-by: Su Hui <suhui@nfschina.com>
---
drivers/fsi/fsi-scom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index bcb756dc9866..caaf7738eb98 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -335,7 +335,7 @@ static ssize_t scom_read(struct file *filep, char __user *buf, size_t len,
if (rc)
dev_dbg(dev, "copy to user failed:%d\n", rc);

- return rc ? rc : len;
+ return rc ? -EFAULT : len;
}

static ssize_t scom_write(struct file *filep, const char __user *buf,
--
2.30.2
\
 
 \ /
  Last update: 2023-05-19 03:38    [W:0.084 / U:0.428 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site