Skip to content

Commit b14bb2e

Browse files
Dan Carpenterjenswi-linaro
authored andcommitted
tee: qcom: prevent potential off by one read
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: d6e2908 ("tee: add Qualcomm TEE driver") 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>
1 parent dcc7a57 commit b14bb2e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/tee/qcomtee/call.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static int qcomtee_params_from_args(struct tee_param *params,
308308
}
309309

310310
/* Release any IO and OO objects not processed. */
311-
for (; u[i].type && i < num_params; i++) {
311+
for (; i < num_params && u[i].type; i++) {
312312
if (u[i].type == QCOMTEE_ARG_TYPE_OO ||
313313
u[i].type == QCOMTEE_ARG_TYPE_IO)
314314
qcomtee_object_put(u[i].o);

0 commit comments

Comments
 (0)