Commit ae17467e authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

nvme: check BAR map return code before using addr



Swap the order of checks in the failure check - if rc is not 0, addr may
be garbage.

Change-Id: I110710efd00397c777d59ac8b219ba3cc2156596
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent 81d92138
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -990,7 +990,7 @@ nvme_ctrlr_map_cmb(struct spdk_nvme_ctrlr *ctrlr)
		goto exit;

	rc = nvme_pcicfg_map_bar_write_combine(ctrlr->devhandle, bir, &addr);
	if (addr == NULL || (rc != 0))
	if ((rc != 0) || addr == NULL)
		goto exit;

	ctrlr->cmb_bar_virt_addr = addr;