From: Dan Carpenter <dan.carpenter@oracle.com>
To: Eddie James <eajames@linux.ibm.com>
Cc: Andrew Jeffery <andrew@aj.id.au>,
kernel-janitors@vger.kernel.org, Joel Stanley <joel@jms.id.au>,
linux-aspeed@lists.ozlabs.org,
linux-arm-kernel@lists.infradead.org
Subject: [PATCH] soc: aspeed: xdma: Return -EFAULT if copy_from_user() fails
Date: Wed, 30 Sep 2020 12:03:34 +0300 [thread overview]
Message-ID: <20200930090334.GB621698@mwanda> (raw)
The copy_from_user() function returns the number of bytes remaining
which we weren't able to copy. This should return -EFAULT to the
user.
Fixes: 86609baa4217 ("soc: aspeed: xdma: Add user interface")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/soc/aspeed/aspeed-xdma.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/soc/aspeed/aspeed-xdma.c b/drivers/soc/aspeed/aspeed-xdma.c
index 91b51a3de8df..e6b4744bda64 100644
--- a/drivers/soc/aspeed/aspeed-xdma.c
+++ b/drivers/soc/aspeed/aspeed-xdma.c
@@ -569,9 +569,8 @@ static ssize_t aspeed_xdma_write(struct file *file, const char __user *buf,
if (len != sizeof(op))
return -EINVAL;
- rc = copy_from_user(&op, buf, len);
- if (rc)
- return rc;
+ if (copy_from_user(&op, buf, len))
+ return -EFAULT;
if (!op.len || op.len > client->size ||
op.direction > ASPEED_XDMA_DIRECTION_UPSTREAM)
--
2.28.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next reply other threads:[~2020-09-30 9:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-30 9:03 Dan Carpenter [this message]
2020-09-30 13:38 ` [PATCH] soc: aspeed: xdma: Return -EFAULT if copy_from_user() fails Eddie James
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=20200930090334.GB621698@mwanda \
--to=dan.carpenter@oracle.com \
--cc=andrew@aj.id.au \
--cc=eajames@linux.ibm.com \
--cc=joel@jms.id.au \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-aspeed@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).