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

Commit 2ef8a9aa authored by Kenneth Westfield's avatar Kenneth Westfield
Browse files

ASoC: msm: qdsp6v2: Add upper bounds check on index



Add upper bounds check for return value of
q6audio_get_port_index().

CRs-Fixed: 575227
Change-Id: I263fc6d759beffd2c2fecc7794c279939ab25401
Signed-off-by: default avatarKenneth Westfield <kwestfie@codeaurora.org>
parent 9c6389a6
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -448,8 +448,9 @@ static void afe_send_cal_block(int32_t path, u16 port_id)
	}

	index = q6audio_get_port_index(port_id);
	if (index < 0) {
		pr_debug("%s: AFE port index invalid!\n", __func__);
	if (index < 0 || index > AFE_MAX_PORTS) {
		pr_debug("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		goto done;
	}

@@ -665,8 +666,9 @@ static int afe_send_hw_delay(u16 port_id, u32 rate)
	}

	index = q6audio_get_port_index(port_id);
	if (index < 0) {
		pr_debug("%s: AFE port index invalid!\n", __func__);
	if (index < 0 || index > AFE_MAX_PORTS) {
		pr_debug("%s: AFE port index[%d] invalid!\n",
				__func__, index);
		goto fail_cmd;
	}