Commit 737667e1 authored by Sebastian Brzezinka's avatar Sebastian Brzezinka Committed by Jim Harris
Browse files

lib/env_ocf: place `allocator` variable on hugepages



When using `__lsan_do_recoverable_leak_check` (e.g when fuzzing),
to check for leaks during runtime. Leak sanitizer can not follow
reference of memory that is allocated on heap (e.g. calloc)
and then stored on hugepage causing lsan to incorrectly report
direct leak.

Fixes #2967

Signed-off-by: default avatarSebastian Brzezinka <sebastian.brzezinka@intel.com>
Change-Id: I3511e117a07ca8daa96f19bf1437c0d788b64cb1
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17682


Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAmir Haroush <amir.haroush@huawei.com>
parent 26b9be75
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ env_allocator_create_extended(uint32_t size, const char *name, int limit, bool z
	snprintf(qualified_name, OCF_ALLOCATOR_NAME_MAX, "ocf_env_%d:%s",
		 env_atomic_inc_return(&g_env_allocator_index), name);

	allocator = calloc(1, sizeof(*allocator));
	allocator = env_zalloc(sizeof(*allocator), ENV_MEM_NOIO);
	if (!allocator) {
		return NULL;
	}
@@ -101,7 +101,7 @@ env_allocator_destroy(env_allocator *allocator)
		}

		spdk_mempool_free(allocator->mempool);
		free(allocator);
		env_free(allocator);
	}
}
/* *** CRC *** */