Commit 46f3260a authored by Tomasz Zawadzki's avatar Tomasz Zawadzki Committed by Ben Walker
Browse files

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: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459756


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avataryidong0635 <dongx.yi@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
parent 3a65c872
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;