bdev_nvme_rpc: NULL check for multipath

Pointer 'ctx->req.multipath' returned from call to
function 'strdup' may be NULL. Reported by Klocwork.

Change-Id: Id4a188ec5340f02c9bd0643db0acb03409dd5829
Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9843
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: GangCao <gang.cao@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
Liu Xiaodong 2021-10-12 18:58:11 -04:00 committed by Tomasz Zawadzki
parent 0403d3736a
commit a3d93c468c

View File

@ -398,6 +398,10 @@ rpc_bdev_nvme_attach_controller(struct spdk_jsonrpc_request *request,
"it was used to add a failover path. This behavior will default to rejecting "
"the request in the future. Specify the 'multipath' parameter to control the behavior");
ctx->req.multipath = strdup("failover");
if (ctx->req.multipath == NULL) {
SPDK_ERRLOG("cannot allocate multipath failover string\n");
goto cleanup;
}
}
opts = spdk_nvme_ctrlr_get_opts(ctrlr->ctrlr);