soc: qcom: minidump: check the size parameter passed to qcom_smem_get()

The size parameter passed to qcom_smem_get() can become less than
global toc size, add check to avoid out of bound accessing.

Change-Id: I068b4d5e27e94ce23c26856dad106a3970fb56d6
Signed-off-by: Srinivasarao Pathipati <quic_c_spathi@quicinc.com>
This commit is contained in:
Srinivasarao Pathipati 2023-07-04 11:48:50 +05:30
commit 30e8ee90cb

View file

@ -561,7 +561,7 @@ static int __init msm_minidump_init(void)
}
/*Check global minidump support initialization */
if (!md_global_toc->md_toc_init) {
if (size < sizeof(*md_global_toc) || !md_global_toc->md_toc_init) {
pr_err("System Minidump TOC not initialized\n");
return -ENODEV;
}