diag: Fix type cast in mempool size comparison

Fixes: af0231d9244ee70d7fee9ae479c22d82bcc95ce4
[diag: Sanitize the mempools with pool data size check]

Change-Id: I31cc857e0be62c9238afa565be3dc7a3ed9f246d
Signed-off-by: Richard Raya <rdxzv.dev@gmail.com>
This commit is contained in:
Richard Raya 2024-09-29 17:04:16 -03:00
parent f0bc0f45b3
commit 091c0e1046

View File

@ -181,7 +181,7 @@ void *diagmem_alloc(struct diagchar_dev *driver, int size, int pool_type)
break;
}
if (size == 0 || size > mempool->itemsize ||
size > (long)mempool->pool->pool_data) {
size > (size_t)mempool->pool->pool_data) {
pr_err_ratelimited("diag: cannot alloc from mempool %s, invalid size: %d\n",
mempool->name, size);
break;