From 3da8af26b005a8edf23eaae66f9bcdbad7e8e78b Mon Sep 17 00:00:00 2001 From: Daniel Verkamp Date: Mon, 4 Jan 2016 14:09:42 -0700 Subject: [PATCH] nvme/perf: don't crash if no namespaces are usable Change-Id: I8ecf5b632c2d3bf94f913fb5e0aa5b4ff2e68c40 Signed-off-by: Daniel Verkamp --- examples/nvme/perf/perf.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/nvme/perf/perf.c b/examples/nvme/perf/perf.c index 2a55c9ad8..07dd6a764 100644 --- a/examples/nvme/perf/perf.c +++ b/examples/nvme/perf/perf.c @@ -772,6 +772,10 @@ associate_workers_with_ns(void) count = g_num_namespaces > g_num_workers ? g_num_namespaces : g_num_workers; for (i = 0; i < count; i++) { + if (entry == NULL) { + break; + } + ns_ctx = malloc(sizeof(struct ns_worker_ctx)); if (!ns_ctx) { return -1;