Commit a3d93c46 authored by Liu Xiaodong's avatar Liu Xiaodong Committed by Tomasz Zawadzki
Browse files

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: default avatarLiu 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarGangCao <gang.cao@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 0403d373
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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);