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

Commit 3bfe5a89 authored by Karthikeyan Mani's avatar Karthikeyan Mani Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: wcd9335: Fix out of bounds for mad input value



Add check in tasha_mad_input_put function to
return error on out of bounds access using
mad input value.

CRs-fixed: 1096799
Change-Id: Iddaa3fef362f7cb1919aa3bd8dd4b83133fe7c97
Signed-off-by: default avatarKarthikeyan Mani <kmani@codeaurora.org>
parent c1b67407
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -7575,6 +7575,13 @@ static int tasha_mad_input_put(struct snd_kcontrol *kcontrol,


	tasha_mad_input = ucontrol->value.integer.value[0];
	tasha_mad_input = ucontrol->value.integer.value[0];


	if (tasha_mad_input >= ARRAY_SIZE(tasha_conn_mad_text)) {
		dev_err(codec->dev,
			"%s: tasha_mad_input = %d out of bounds\n",
			__func__, tasha_mad_input);
		return -EINVAL;
	}

	if (!strcmp(tasha_conn_mad_text[tasha_mad_input], "NOTUSED1") ||
	if (!strcmp(tasha_conn_mad_text[tasha_mad_input], "NOTUSED1") ||
	    !strcmp(tasha_conn_mad_text[tasha_mad_input], "NOTUSED2") ||
	    !strcmp(tasha_conn_mad_text[tasha_mad_input], "NOTUSED2") ||
	    !strcmp(tasha_conn_mad_text[tasha_mad_input], "NOTUSED3") ||
	    !strcmp(tasha_conn_mad_text[tasha_mad_input], "NOTUSED3") ||