From 8f8a56af64861725891deb91bedf4682fa666211 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 1 Nov 2019 10:49:39 -0700 Subject: [PATCH] trace: fix calculation of histories_size The last lcore_offsets value already marks the total size of the histories file - we don't need to also add sizeof(struct spdk_trace_flags). Note that this only affected the amount of memory that was mmap'ed. It did not result in any observable failure. Fixes issue #997. Reported-by: tinnfu (GitHub submitter) Signed-off-by: Jim Harris Change-Id: I70fef16241cf00228bc515678cca1721f440c925 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/473049 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker Reviewed-by: tinnfu --- lib/trace/trace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/trace/trace.c b/lib/trace/trace.c index 343c66d2b..46190213b 100644 --- a/lib/trace/trace.c +++ b/lib/trace/trace.c @@ -91,7 +91,7 @@ spdk_trace_init(const char *shm_name, uint64_t num_entries) for (i = 1; i < (int)SPDK_COUNTOF(lcore_offsets); i++) { lcore_offsets[i] = spdk_get_trace_history_size(num_entries) + lcore_offsets[i - 1]; } - histories_size = sizeof(struct spdk_trace_flags) + lcore_offsets[SPDK_TRACE_MAX_LCORE]; + histories_size = lcore_offsets[SPDK_TRACE_MAX_LCORE]; snprintf(g_shm_name, sizeof(g_shm_name), "%s", shm_name);