From e9030f36bc2672216cc333e940696627451aba19 Mon Sep 17 00:00:00 2001 From: GangCao Date: Tue, 12 Oct 2021 10:37:58 -0400 Subject: [PATCH] trace: add an assert for the valid history Change-Id: I4dd97351354af8ccdd0684afda06e6f2e8889839 Signed-off-by: GangCao Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9828 Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Tomasz Zawadzki --- lib/trace_parser/trace.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/trace_parser/trace.cpp b/lib/trace_parser/trace.cpp index 49098d50a9..18abdab30c 100644 --- a/lib/trace_parser/trace.cpp +++ b/lib/trace_parser/trace.cpp @@ -342,6 +342,7 @@ spdk_trace_parser::init(const spdk_trace_parser_opts *opts) if (opts->lcore == SPDK_TRACE_MAX_LCORE) { for (i = 0; i < SPDK_TRACE_MAX_LCORE; i++) { history = spdk_get_per_lcore_history(_histories, i); + assert(history); if (history->num_entries == 0 || history->entries[0].tsc == 0) { continue; } @@ -350,6 +351,7 @@ spdk_trace_parser::init(const spdk_trace_parser_opts *opts) } } else { history = spdk_get_per_lcore_history(_histories, opts->lcore); + assert(history); if (history->num_entries > 0 && history->entries[0].tsc != 0) { populate_events(history, history->num_entries); }