* [PATCH] soc: aspeed: xdma: Return -EFAULT if copy_from_user() fails
@ 2020-09-30 9:03 Dan Carpenter
2020-09-30 13:38 ` Eddie James
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2020-09-30 9:03 UTC (permalink / raw)
To: Eddie James
Cc: Andrew Jeffery, kernel-janitors, Joel Stanley, linux-aspeed,
linux-arm-kernel
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] soc: aspeed: xdma: Return -EFAULT if copy_from_user() fails
2020-09-30 9:03 [PATCH] soc: aspeed: xdma: Return -EFAULT if copy_from_user() fails Dan Carpenter
@ 2020-09-30 13:38 ` Eddie James
0 siblings, 0 replies; 2+ messages in thread
From: Eddie James @ 2020-09-30 13:38 UTC (permalink / raw)
To: Dan Carpenter
Cc: Andrew Jeffery, kernel-janitors, Joel Stanley, linux-aspeed,
linux-arm-kernel
On 9/30/20 4:03 AM, Dan Carpenter wrote:
> 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.
Thanks,
Reviewed-by: Eddie James <eajames@linux.ibm.com>
>
> 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)
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-30 13:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-30 9:03 [PATCH] soc: aspeed: xdma: Return -EFAULT if copy_from_user() fails Dan Carpenter
2020-09-30 13:38 ` Eddie James
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).