Commit a7cd3a2d authored by Marcin Spiewak's avatar Marcin Spiewak Committed by Konrad Sztyber
Browse files

lib/bdev: fixed potential dereferencing of NULL pointer



Fixed issue indicated by Klocwork scan. 'desc->bdev'
is assigned to 'bdev' ptr, before verification that
'desc' is not NULL

Change-Id: I36e63c27b4d3220e85524133a0ec0e3521770875
Signed-off-by: default avatarMarcin Spiewak <marcin.spiewak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17350


Reviewed-by: default avatarAleksey Marchuk <alexeymar@nvidia.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 20c6796e
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -8122,7 +8122,7 @@ spdk_bdev_module_claim_bdev_desc(struct spdk_bdev_desc *desc, enum spdk_bdev_cla
				 struct spdk_bdev_claim_opts *_opts,
				 struct spdk_bdev_module *module)
{
	struct spdk_bdev *bdev = desc->bdev;
	struct spdk_bdev *bdev;
	struct spdk_bdev_claim_opts opts;
	int rc = 0;

@@ -8131,6 +8131,8 @@ spdk_bdev_module_claim_bdev_desc(struct spdk_bdev_desc *desc, enum spdk_bdev_cla
		return -EINVAL;
	}

	bdev = desc->bdev;

	if (_opts == NULL) {
		spdk_bdev_claim_opts_init(&opts, sizeof(opts));
	} else if (claim_opts_copy(_opts, &opts) != 0) {