From 668c8c57bea4104ff527eb0fb64bec74cd158a69 Mon Sep 17 00:00:00 2001 From: Darek Stojaczyk Date: Fri, 28 Dec 2018 11:18:17 +0100 Subject: [PATCH] vtophys: fix uninitialized variable read on mem unregister spdk_mem_map_translate() inside the vtophys unregister callback could potentially read unitialized variable. This isn't critical since vtophys mem map doesn't yet implement the callback for checking mem contiguity and the spdk_mem_map_translate() was exiting early - before the unitialized variable was actually processed. It was still technically dereferenced though, which is a bug. Change-Id: I2af52e6f41bee35528c3d771aafd9c768c9d2fc7 Signed-off-by: Darek Stojaczyk Reviewed-on: https://review.gerrithub.io/c/438445 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: wuzhouhui Reviewed-by: Shuhei Matsumoto --- lib/env_dpdk/vtophys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/env_dpdk/vtophys.c b/lib/env_dpdk/vtophys.c index 9e4d4fa50..df29ae281 100644 --- a/lib/env_dpdk/vtophys.c +++ b/lib/env_dpdk/vtophys.c @@ -400,7 +400,7 @@ spdk_vtophys_notify(void *cb_ctx, struct spdk_mem_map *map, * we need to unmap the range from the IOMMU */ if (g_vfio.enabled) { - uint64_t buffer_len; + uint64_t buffer_len = VALUE_2MB; paddr = spdk_mem_map_translate(map, (uint64_t)vaddr, &buffer_len); if (buffer_len != VALUE_2MB) { return -EINVAL;