Skip to contentSkip to conversation

tee: qcom: return -EFAULT instead of -EINVAL if copy_from_user() fails

PATCH Applied Dan Carpenter 3 participants 3 messages Sep 18, 2025 – Sep 19, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

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.

---
 drivers/tee/qcomtee/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tee/qcomtee/core.c +1 -1
index 783acc59cfa9..b6715ada7700 100644
@@ -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
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Dan Carpenter

If copy_from_user() fails, the correct error code is -EFAULT, not -EINVAL.

---
 drivers/tee/qcomtee/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-Sumit

Quoted 17 lines
drivers/tee/qcomtee/core.c +1 -1
index 783acc59cfa9..b6715ada7700 100644
@@ -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
#2 lore raw
Quoted 11 lines · Sumit Garg
Quoted 7 lines · Dan Carpenter

If copy_from_user() fails, the correct error code is -EFAULT, not -EINVAL.

---
 drivers/tee/qcomtee/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied.

/Jens

Quoted 20 lines

-Sumit

Quoted 17 lines
drivers/tee/qcomtee/core.c +1 -2
index 783acc59cfa9..b6715ada7700 100644
@@ -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