From 80fd67d79a66c45171890460ed8a8cc8bc83bb7a Mon Sep 17 00:00:00 2001 From: Wenkai Lin Date: Thu, 30 Dec 2021 12:07:28 +0800 Subject: [PATCH 16/28] uadk: mempool: check stats null pointer If user input's stats is null pointer, it will cause a segment fault, fix it. Signed-off-by: Wenkai Lin --- wd_mempool.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wd_mempool.c b/wd_mempool.c index bbf5edb..b6e1088 100644 --- a/wd_mempool.c +++ b/wd_mempool.c @@ -958,6 +958,11 @@ void wd_mempool_stats(handle_t mempool, struct wd_mempool_stats *stats) return; } + if (!stats) { + WD_ERR("wd_mempool: mempool stats is NULL\n"); + return; + } + wd_spinlock(&mp->lock); stats->page_type = mp->page_type; -- 2.31.1