qcacmn: Add memory corruption check

Do not allocate memory if the ask is larger than the
maximum memory allowed for malloc. We have it limited to 4MB.

CRs-Fixed: 2828104
Change-Id: I5b463dd8eb640c76882653e82e6f6db7cb651cf2
This commit is contained in:
Adwait Nayak
2020-12-17 02:42:33 +05:30
committed by snandini
parent a7a79a9b8d
commit 8ca19e58fe

View File

@@ -1780,6 +1780,12 @@ void *qdf_mem_malloc_atomic_fl(size_t size, const char *func, uint32_t line)
{
void *ptr;
if (!size || size > QDF_MEM_MAX_MALLOC) {
qdf_nofl_err("Cannot malloc %zu bytes @ %s:%d", size, func,
line);
return NULL;
}
ptr = qdf_mem_prealloc_get(size);
if (ptr)
return ptr;