ASoC: msm-lsm-client: Integer overflow check

Add integer overflow check for lsm_params_get_info size.

Change-Id: I1130b5294f5de65eb8c595030c4db221337b1c8a
Signed-off-by: Soumya Managoli <quic_c_smanag@quicinc.com>
This commit is contained in:
Soumya Managoli 2023-06-21 17:17:03 +05:30 committed by Gerrit - the friendly Code Review server
parent ba56a64009
commit bbf1413556

View File

@ -2653,6 +2653,15 @@ static int msm_lsm_ioctl(struct snd_pcm_substream *substream,
err = -EFAULT;
goto done;
}
if (temp_p_info.param_size > 0 &&
((INT_MAX - sizeof(temp_p_info)) <
temp_p_info.param_size)) {
pr_err("%s: Integer overflow\n", __func__);
err = -EINVAL;
goto done;
}
size = sizeof(temp_p_info) + temp_p_info.param_size;
p_info = kzalloc(size, GFP_KERNEL);