Commit b14bb2e7 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jens Wiklander
Browse files

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: d6e29083 ("tee: add Qualcomm TEE driver")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: default avatarSumit Garg <sumit.garg@oss.qualcomm.com>
Signed-off-by: default avatarJens Wiklander <jens.wiklander@linaro.org>
parent dcc7a571
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);