ut/lvol: fixed scan-build error on spdk_bs_init

Scan-build didn't get that spdk_bs_init() assigns the blobstore to dev.bs
and there was no point at which it could fail (without *_FATAL) before checking it.
Additional assert added to make sure scan-build is aware.

lvol_ut.c:1105:27: warning: Access to field 'get_super_status' results in a dereference of a null pointer (loaded from field 'bs')
        dev.bs->get_super_status = -1;
            ~~                   ^

This is related to issue #822.

Change-Id: Id44d12ced4bc25490ca4e0949cbdfb89508a6e06
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459756
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: yidong0635 <dongx.yi@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Tomasz Zawadzki 2019-06-28 05:53:18 -04:00 committed by Ben Walker
parent 3a65c8729b
commit 46f3260a69

View File

@ -1091,6 +1091,7 @@ lvs_load(void)
spdk_bs_opts_init(&bs_opts);
snprintf(bs_opts.bstype.bstype, sizeof(bs_opts.bstype.bstype), "LVOLSTORE");
spdk_bs_init(&dev.bs_dev, &bs_opts, null_cb, NULL);
SPDK_CU_ASSERT_FATAL(dev.bs != NULL);
/* Fail on bs load */
dev.load_status = -1;