* [PATCH] tee: qcom: return -EFAULT instead of -EINVAL if copy_from_user() fails
@ 2025-09-18 9:50 Dan Carpenter
2025-09-19 5:21 ` Sumit Garg via OP-TEE
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2025-09-18 9:50 UTC (permalink / raw)
To: Amirreza Zarrabi
Cc: Sumit Garg, linux-arm-msm, op-tee, linux-kernel, kernel-janitors
If copy_from_user() fails, the correct error code is -EFAULT, not
-EINVAL.
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
drivers/tee/qcomtee/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tee/qcomtee/core.c b/drivers/tee/qcomtee/core.c
index 783acc59cfa9..b6715ada7700 100644
--- a/drivers/tee/qcomtee/core.c
+++ b/drivers/tee/qcomtee/core.c
@@ -424,7 +424,7 @@ static int qcomtee_prepare_msg(struct qcomtee_object_invoke_ctx *oic,
if (!(u[i].flags & QCOMTEE_ARG_FLAGS_UADDR))
memcpy(msgptr, u[i].b.addr, u[i].b.size);
else if (copy_from_user(msgptr, u[i].b.uaddr, u[i].b.size))
- return -EINVAL;
+ return -EFAULT;
offset += qcomtee_msg_offset_align(u[i].b.size);
ib++;
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tee: qcom: return -EFAULT instead of -EINVAL if copy_from_user() fails
2025-09-18 9:50 [PATCH] tee: qcom: return -EFAULT instead of -EINVAL if copy_from_user() fails Dan Carpenter
@ 2025-09-19 5:21 ` Sumit Garg via OP-TEE
2025-09-19 7:58 ` Jens Wiklander
0 siblings, 1 reply; 3+ messages in thread
From: Sumit Garg via OP-TEE @ 2025-09-19 5:21 UTC (permalink / raw)
To: Dan Carpenter
Cc: Amirreza Zarrabi, linux-arm-msm, op-tee, linux-kernel,
kernel-janitors
On Thu, Sep 18, 2025 at 12:50:41PM +0300, Dan Carpenter wrote:
> If copy_from_user() fails, the correct error code is -EFAULT, not
> -EINVAL.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
> drivers/tee/qcomtee/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
-Sumit
>
> diff --git a/drivers/tee/qcomtee/core.c b/drivers/tee/qcomtee/core.c
> index 783acc59cfa9..b6715ada7700 100644
> --- a/drivers/tee/qcomtee/core.c
> +++ b/drivers/tee/qcomtee/core.c
> @@ -424,7 +424,7 @@ static int qcomtee_prepare_msg(struct qcomtee_object_invoke_ctx *oic,
> if (!(u[i].flags & QCOMTEE_ARG_FLAGS_UADDR))
> memcpy(msgptr, u[i].b.addr, u[i].b.size);
> else if (copy_from_user(msgptr, u[i].b.uaddr, u[i].b.size))
> - return -EINVAL;
> + return -EFAULT;
>
> offset += qcomtee_msg_offset_align(u[i].b.size);
> ib++;
> --
> 2.51.0
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tee: qcom: return -EFAULT instead of -EINVAL if copy_from_user() fails
2025-09-19 5:21 ` Sumit Garg via OP-TEE
@ 2025-09-19 7:58 ` Jens Wiklander
0 siblings, 0 replies; 3+ messages in thread
From: Jens Wiklander @ 2025-09-19 7:58 UTC (permalink / raw)
To: Sumit Garg
Cc: Dan Carpenter, Amirreza Zarrabi, linux-arm-msm, op-tee,
linux-kernel, kernel-janitors
On Fri, Sep 19, 2025 at 7:22 AM Sumit Garg <sumit.garg@kernel.org> wrote:
>
> On Thu, Sep 18, 2025 at 12:50:41PM +0300, Dan Carpenter wrote:
> > If copy_from_user() fails, the correct error code is -EFAULT, not
> > -EINVAL.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> > ---
> > drivers/tee/qcomtee/core.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Applied.
/Jens
>
> -Sumit
>
> >
> > diff --git a/drivers/tee/qcomtee/core.c b/drivers/tee/qcomtee/core.c
> > index 783acc59cfa9..b6715ada7700 100644
> > --- a/drivers/tee/qcomtee/core.c
> > +++ b/drivers/tee/qcomtee/core.c
> > @@ -424,7 +424,7 @@ static int qcomtee_prepare_msg(struct qcomtee_object_invoke_ctx *oic,
> > if (!(u[i].flags & QCOMTEE_ARG_FLAGS_UADDR))
> > memcpy(msgptr, u[i].b.addr, u[i].b.size);
> > else if (copy_from_user(msgptr, u[i].b.uaddr, u[i].b.size))
> > - return -EINVAL;
> > + return -EFAULT;
> >
> > offset += qcomtee_msg_offset_align(u[i].b.size);
> > ib++;
> > --
> > 2.51.0
> >
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-19 7:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-18 9:50 [PATCH] tee: qcom: return -EFAULT instead of -EINVAL if copy_from_user() fails Dan Carpenter
2025-09-19 5:21 ` Sumit Garg via OP-TEE
2025-09-19 7:58 ` Jens Wiklander
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox