From 3e937f07eb6a8ee7c7c444c2671e7f749faa8ea6 Mon Sep 17 00:00:00 2001 From: Jaylyn Ren Date: Tue, 16 Nov 2021 18:00:02 +0800 Subject: [PATCH] test/accel&rdma: Fix unittest_accel and unittest_nvme_rdma failure There are errors occur that uninitialised value created by a stack allocation when running unittest_accel and unittest_nvme_rdma with valgrind. Change-Id: I4b48b472cc7c189cbcaf8ca772830a23118e7e17 Signed-off-by: Jaylyn Ren Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/10559 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Xiaodong Liu Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker --- lib/nvme/nvme_rdma.c | 2 +- test/unit/lib/accel/accel.c/accel_engine_ut.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/nvme/nvme_rdma.c b/lib/nvme/nvme_rdma.c index c1e688775..ab852feba 100644 --- a/lib/nvme/nvme_rdma.c +++ b/lib/nvme/nvme_rdma.c @@ -1357,7 +1357,7 @@ nvme_rdma_get_memory_translation(struct nvme_request *req, struct nvme_rdma_qpai struct nvme_rdma_memory_translation_ctx *_ctx) { struct spdk_memory_domain_translation_ctx ctx; - struct spdk_memory_domain_translation_result dma_translation; + struct spdk_memory_domain_translation_result dma_translation = {.iov_count = 0}; struct spdk_rdma_memory_translation rdma_translation; int rc; diff --git a/test/unit/lib/accel/accel.c/accel_engine_ut.c b/test/unit/lib/accel/accel.c/accel_engine_ut.c index 5cabba712..c9b89064b 100644 --- a/test/unit/lib/accel/accel.c/accel_engine_ut.c +++ b/test/unit/lib/accel/accel.c/accel_engine_ut.c @@ -216,8 +216,8 @@ static void test_spdk_accel_submit_copy(void) { const uint64_t nbytes = TEST_SUBMIT_SIZE; - uint8_t dst[TEST_SUBMIT_SIZE]; - uint8_t src[TEST_SUBMIT_SIZE]; + uint8_t dst[TEST_SUBMIT_SIZE] = {0}; + uint8_t src[TEST_SUBMIT_SIZE] = {0}; void *cb_arg = NULL; int rc; struct spdk_accel_task task;