Commit 668c8c57 authored by Darek Stojaczyk's avatar Darek Stojaczyk Committed by Jim Harris
Browse files

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: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-on: https://review.gerrithub.io/c/438445


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarwuzhouhui <wuzhouhui@kingsoft.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent ec5972cb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;