From 1c72d89b848290814601517e73f6a9d8eb6e5caa Mon Sep 17 00:00:00 2001 From: Wenkai Lin Date: Thu, 3 Mar 2022 15:10:04 +0800 Subject: [PATCH 082/109] uadk: v1: fix pool cstatus memset problem wd_alloc_id use __atomic_test_and_set to find an available cookie with zero status, it may not find a zero cookie with dirty memory, so cookie status region should be set to zero. Signed-off-by: Wenkai Lin --- v1/wd_util.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/v1/wd_util.c b/v1/wd_util.c index 715804c..112cc16 100644 --- a/v1/wd_util.c +++ b/v1/wd_util.c @@ -92,6 +92,8 @@ int wd_init_cookie_pool(struct wd_cookie_pool *pool, return -WD_ENOMEM; pool->cstatus = (void *)((uintptr_t)pool->cookies + total_size); + memset(pool->cstatus, 0, cookies_num); + pool->cookies_num = cookies_num; pool->cookies_size = cookies_size; pool->cid = 0; -- 2.27.0