From 2e69975fab3361872c4c8ad1d6dfbce2c484017c Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Wed, 22 Apr 2020 16:45:27 -0700 Subject: [PATCH] lib/event: add asserts that reactors aren't NULL. In practice, the reactor pointers will never be NULL in these cases, but some static analysis tools don't realize that. Signed-off-by: Seth Howell Change-Id: I0657959e5572df2741398b179907f2bbf0b02b3b Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1984 Tested-by: SPDK CI Jenkins Reviewed-by: Shuhei Matsumoto Reviewed-by: Tomasz Zawadzki Community-CI: Mellanox Build Bot --- lib/event/reactor.c | 3 ++- module/event/rpc/app_rpc.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/event/reactor.c b/lib/event/reactor.c index 913bc4b89..a6af933cd 100644 --- a/lib/event/reactor.c +++ b/lib/event/reactor.c @@ -154,8 +154,9 @@ spdk_reactors_fini(void) SPDK_ENV_FOREACH_CORE(i) { reactor = spdk_reactor_get(i); + assert(reactor != NULL); assert(reactor->thread_count == 0); - if (spdk_likely(reactor != NULL) && reactor->events != NULL) { + if (reactor->events != NULL) { spdk_ring_free(reactor->events); } } diff --git a/module/event/rpc/app_rpc.c b/module/event/rpc/app_rpc.c index 06fead7f5..b02f454cb 100644 --- a/module/event/rpc/app_rpc.c +++ b/module/event/rpc/app_rpc.c @@ -374,6 +374,8 @@ rpc_framework_get_reactors(void *arg1, void *arg2) current_core = spdk_env_get_current_core(); reactor = spdk_reactor_get(current_core); + assert(reactor != NULL); + spdk_json_write_object_begin(ctx->w); spdk_json_write_named_uint32(ctx->w, "lcore", current_core); spdk_json_write_named_uint64(ctx->w, "busy", reactor->busy_tsc);