From 46f3260a6926eaa9532bebdd99a5f1afee1d9a60 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Fri, 28 Jun 2019 05:53:18 -0400 Subject: [PATCH] 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 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/459756 Tested-by: SPDK CI Jenkins Reviewed-by: Paul Luse Reviewed-by: yidong0635 Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker --- test/unit/lib/lvol/lvol.c/lvol_ut.c | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit/lib/lvol/lvol.c/lvol_ut.c b/test/unit/lib/lvol/lvol.c/lvol_ut.c index 7c93e461b..271773f13 100644 --- a/test/unit/lib/lvol/lvol.c/lvol_ut.c +++ b/test/unit/lib/lvol/lvol.c/lvol_ut.c @@ -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;