From: Weili Qian <qianweili@huawei.com> wd_pool_init in wd_bmm.c allocated blk_array with malloc, leaving elements uninitialized and passing garbage blk/blk_dma to wd_iova_unmap on the error cleanup path. wd_comp_init_nolock in wd_comp.c called wd_alg_init_driver redundantly since the caller already invokes it, causing double initialization. Use calloc to zero-initialize blk_array and remove the redundant wd_alg_init_driver call to match other modules. Signed-off-by: Weili Qian <qianweili@huawei.com> --- wd_bmm.c | 2 +- wd_comp.c | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/wd_bmm.c b/wd_bmm.c index 811afa2..e393e59 100644 --- a/wd_bmm.c +++ b/wd_bmm.c @@ -707,7 +707,7 @@ static int wd_pool_init(struct wd_blkpool *p) } /* Allocate block array */ - p->blk_array = (struct wd_blk_hd *)malloc(act_num * sizeof(struct wd_blk_hd)); + p->blk_array = (struct wd_blk_hd *)calloc(act_num, sizeof(struct wd_blk_hd)); if (!p->blk_array) { WD_ERR("Failed to allocate block array.\n"); return -WD_ENOMEM; diff --git a/wd_comp.c b/wd_comp.c index 35af141..523a189 100644 --- a/wd_comp.c +++ b/wd_comp.c @@ -156,14 +156,8 @@ static int wd_comp_init_nolock(struct wd_ctx_config *config, struct wd_sched *sc if (ret < 0) goto out_clear_sched; - ret = wd_alg_init_driver(&wd_comp_setting.config); - if (ret) - goto out_clear_pool; - return 0; -out_clear_pool: - wd_uninit_async_request_pool(&wd_comp_setting.pool); out_clear_sched: wd_clear_sched(&wd_comp_setting.sched); out_clear_ctx_config: -- 2.50.1.windows.1