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 <dongx.yi@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/454536
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
yidong0635 2019-05-15 08:10:22 -04:00 committed by Jim Harris
parent 1c8efbdd51
commit 04ce0e1254

View File

@ -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;