Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46a2e071 authored by Josh Kirsch's avatar Josh Kirsch Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: msm: qdsp6v2: Add error check for index bounds



Add error check for the bounds of the index before
using it to access an array.

Change-Id: I2ac4a396b5ec80d9c8e05852cca72efeffa4ed88
Signed-off-by: default avatarJosh Kirsch <jkirsch@codeaurora.org>
parent 48b9c3db
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -5416,6 +5416,12 @@ int afe_get_sp_ex_vi_ftm_data(struct afe_sp_ex_vi_get_param *ex_vi)
	}

	index = q6audio_get_port_index(port);
	if (index < 0 || index >= AFE_MAX_PORTS) {
		pr_err("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		ret = -EINVAL;
		goto done;
	}
	ex_vi->hdr.hdr_field = APR_HDR_FIELD(APR_MSG_TYPE_SEQ_CMD,
				APR_HDR_LEN(APR_HDR_SIZE), APR_PKT_VER);
	ex_vi->hdr.pkt_size = sizeof(*ex_vi);