tee: qcom: return -EFAULT instead of -EINVAL if copy_from_user() fails
PATCH 1/1 tee: qcom: return -EFAULT instead of -EINVAL if copy_from_user() fails
If copy_from_user() fails, the correct error code is -EFAULT, not -EINVAL.
Signed-off-by Dan Carpenter <[email protected]>
--- drivers/tee/qcomtee/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tee/qcomtee/core.c +1 -1
@@ -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++;
Signature · 1 line
2.51.0
Quoted 7 lines · Dan Carpenter
If
copy_from_user()fails, the correct error code is-EFAULT, not-EINVAL.Signed-off-by Dan Carpenter <[email protected]>--- drivers/tee/qcomtee/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by Sumit Garg <[email protected]>
-Sumit
Quoted 17 lines
drivers/tee/qcomtee/core.c +1
-1@@ -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++;Signature · 1 line
2.51.0
Jens Wiklander
AppliedQuoted 11 lines · Sumit Garg
Quoted 7 lines · Dan Carpenter
If
copy_from_user()fails, the correct error code is-EFAULT, not-EINVAL.Signed-off-by Dan Carpenter <[email protected]>--- drivers/tee/qcomtee/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Reviewed-by Sumit Garg <[email protected]>
Applied.
/Jens
Quoted 20 lines
-Sumit
Quoted 17 lines
drivers/tee/qcomtee/core.c +1
-2@@ -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