]> Gentwo Git Trees - linux/.git/commitdiff
tee: qcom: return -EFAULT instead of -EINVAL if copy_from_user() fails
authorDan Carpenter <dan.carpenter@linaro.org>
Thu, 18 Sep 2025 09:50:41 +0000 (12:50 +0300)
committerJens Wiklander <jens.wiklander@linaro.org>
Fri, 19 Sep 2025 06:46:57 +0000 (08:46 +0200)
If copy_from_user() fails, the correct error code is -EFAULT, not
-EINVAL.

Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Sumit Garg <sumit.garg@oss.qualcomm.com>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
drivers/tee/qcomtee/core.c

index 783acc59cfa9d222bd81518d14766be6aff290a0..b6715ada770092ab75fdbb75946799525ee47701 100644 (file)
@@ -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++;