public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH next] tee: qcom: prevent potential off by one read
@ 2025-09-18  9:50 Dan Carpenter
  2025-09-19  5:21 ` Sumit Garg
  2025-09-23 22:48 ` Amirreza Zarrabi
  0 siblings, 2 replies; 10+ messages in thread
From: Dan Carpenter @ 2025-09-18  9:50 UTC (permalink / raw)
  To: Amirreza Zarrabi
  Cc: Jens Wiklander, Sumit Garg, linux-arm-msm, op-tee, linux-kernel,
	kernel-janitors

Re-order these checks to check if "i" is a valid array index before using
it.  This prevents a potential off by one read access.

Fixes: d6e290837e50 ("tee: add Qualcomm TEE driver")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/tee/qcomtee/call.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tee/qcomtee/call.c b/drivers/tee/qcomtee/call.c
index cc17a48d0ab7..ac134452cc9c 100644
--- a/drivers/tee/qcomtee/call.c
+++ b/drivers/tee/qcomtee/call.c
@@ -308,7 +308,7 @@ static int qcomtee_params_from_args(struct tee_param *params,
 	}
 
 	/* Release any IO and OO objects not processed. */
-	for (; u[i].type && i < num_params; i++) {
+	for (; i < num_params && u[i].type; i++) {
 		if (u[i].type == QCOMTEE_ARG_TYPE_OO ||
 		    u[i].type == QCOMTEE_ARG_TYPE_IO)
 			qcomtee_object_put(u[i].o);
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2025-09-25  1:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-18  9:50 [PATCH next] tee: qcom: prevent potential off by one read Dan Carpenter
2025-09-19  5:21 ` Sumit Garg
2025-09-19  7:59   ` Jens Wiklander
2025-09-23 22:48 ` Amirreza Zarrabi
2025-09-23 22:58   ` Amirreza Zarrabi
2025-09-24  7:35     ` Dan Carpenter
2025-09-24  9:21       ` Jens Wiklander
2025-09-24  9:56         ` Dan Carpenter
2025-09-25  1:46           ` Amirreza Zarrabi
2025-09-24  7:32   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox