From 04ce0e12544d6f8f1298c6cb7bb3eb335b70f4e9 Mon Sep 17 00:00:00 2001 From: yidong0635 Date: Wed, 15 May 2019 08:10:22 -0400 Subject: [PATCH] blob: fix scanbuild failures in this file. Access to field 'tqh_first' results in a dereference of a null pointer set = TAILQ_FIRST(&channel->reqs). Add asserts to check if channel got NULL; Change-Id: Ifd8d131a2432328d683e7fb9357fdd23b2396cf2 Signed-off-by: yidong0635 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454536 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/blob/request.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/blob/request.c b/lib/blob/request.c index cfeac7fab..134d5c969 100644 --- a/lib/blob/request.c +++ b/lib/blob/request.c @@ -107,7 +107,7 @@ spdk_bs_sequence_start(struct spdk_io_channel *_channel, struct spdk_bs_request_set *set; channel = spdk_io_channel_get_ctx(_channel); - + assert(channel != NULL); set = TAILQ_FIRST(&channel->reqs); if (!set) { return NULL; @@ -311,7 +311,7 @@ spdk_bs_batch_open(struct spdk_io_channel *_channel, struct spdk_bs_request_set *set; channel = spdk_io_channel_get_ctx(_channel); - + assert(channel != NULL); set = TAILQ_FIRST(&channel->reqs); if (!set) { return NULL; @@ -466,7 +466,7 @@ spdk_bs_user_op_alloc(struct spdk_io_channel *_channel, struct spdk_bs_cpl *cpl, struct spdk_bs_user_op_args *args; channel = spdk_io_channel_get_ctx(_channel); - + assert(channel != NULL); set = TAILQ_FIRST(&channel->reqs); if (!set) { return NULL;