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: Marcin Spiewak <marcin.spiewak@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/17350 Reviewed-by: Aleksey Marchuk <alexeymar@nvidia.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
20c6796eaf
commit
a7cd3a2d57
@ -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_claim_opts *_opts,
|
||||||
struct spdk_bdev_module *module)
|
struct spdk_bdev_module *module)
|
||||||
{
|
{
|
||||||
struct spdk_bdev *bdev = desc->bdev;
|
struct spdk_bdev *bdev;
|
||||||
struct spdk_bdev_claim_opts opts;
|
struct spdk_bdev_claim_opts opts;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
@ -8131,6 +8131,8 @@ spdk_bdev_module_claim_bdev_desc(struct spdk_bdev_desc *desc, enum spdk_bdev_cla
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bdev = desc->bdev;
|
||||||
|
|
||||||
if (_opts == NULL) {
|
if (_opts == NULL) {
|
||||||
spdk_bdev_claim_opts_init(&opts, sizeof(opts));
|
spdk_bdev_claim_opts_init(&opts, sizeof(opts));
|
||||||
} else if (claim_opts_copy(_opts, &opts) != 0) {
|
} else if (claim_opts_copy(_opts, &opts) != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user