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

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

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



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

CRs-fixed: 1096799
Change-Id: I16f8627b29c7b14a8dc0433b21aa21bf96e98905
Signed-off-by: default avatarKarthikeyan Mani <kmani@codeaurora.org>
parent a72b085f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1377,6 +1377,13 @@ static int tomtom_mad_input_put(struct snd_kcontrol *kcontrol,
	tomtom_mad_input = ucontrol->value.integer.value[0];
	micb_4_int_reg = tomtom->resmgr.reg_addr->micb_4_int_rbias;

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

	pr_debug("%s: tomtom_mad_input = %s\n", __func__,
			tomtom_conn_mad_text[tomtom_mad_input]);