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

Commit c3e92ec3 authored by Sandhya Mutha Naga Venkata's avatar Sandhya Mutha Naga Venkata Committed by Gerrit - the friendly Code Review server
Browse files

dsp: afe: Add check for num_channels



Check for valid num_channels before accessing.

Change-Id: I8f39d12e2f5f52fa145fbd3aed2b023afaa2b53b
Signed-off-by: default avatarSoumya Managoli <quic_c_smanag@quicinc.com>
parent f134827a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1288,6 +1288,9 @@ static int32_t afe_callback(struct apr_client_data *data, void *priv)
				    sizeof(struct afe_port_mod_evt_rsp_hdr));
				uint32_t *dc_presence_flag = num_channels + 1;

				if (*num_channels < 1 || *num_channels > 4)
					return -EINVAL;

				for (i = 0; i < *num_channels; i++) {
					if (dc_presence_flag[i] == 1)
						dc_detected = true;