From: Su Hui <suhui@nfschina.com>
To: Jeremy Kerr <jk@ozlabs.org>, Joel Stanley <joel@jms.id.au>,
Alistar Popple <alistair@popple.id.au>,
Eddie James <eajames@linux.ibm.com>
Cc: eajames@us.ibm.com, cbostic@linux.vnet.ibm.com,
gregkh@linuxfoundation.org, linux-fsi@lists.ozlabs.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Su Hui <suhui@nfschina.com>
Subject: [PATCH] drivers/fsi/scom: Return -EFAULT if copy fails
Date: Fri, 19 May 2023 09:37:10 +0800 [thread overview]
Message-ID: <20230519013710.34954-1-suhui@nfschina.com> (raw)
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
next reply other threads:[~2023-05-19 1:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-19 1:37 Su Hui [this message]
2023-05-22 22:30 ` Guenter Roeck
2023-05-23 4:32 ` Longsuhui
2023-05-23 7:05 ` Dan Carpenter
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=20230519013710.34954-1-suhui@nfschina.com \
--to=suhui@nfschina.com \
--cc=alistair@popple.id.au \
--cc=cbostic@linux.vnet.ibm.com \
--cc=eajames@linux.ibm.com \
--cc=eajames@us.ibm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jk@ozlabs.org \
--cc=joel@jms.id.au \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-fsi@lists.ozlabs.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®