diff --git a/osal/src/osal_mem.c b/osal/src/osal_mem.c index 23886cef3f16426ce4ca43fe8e5b47ae5a6b53a8..22024ab54cf6343176ede0b92437d101bbfda3e9 100644 --- a/osal/src/osal_mem.c +++ b/osal/src/osal_mem.c @@ -47,6 +47,10 @@ static void *osal_mem_alloc(size_t size, uint32_t *type) { char *base = NULL; const uint32_t mng_size = sizeof(struct mem_block); + if (size > (SIZE_MAX - mng_size)) { + HDF_LOGE("%s invalid param %d", __func__, size); + return NULL; + } if (size > (KMALLOC_SIZE - mng_size)) { base = (char *)vmalloc(size + mng_size);