nvme: Fix potential use of non-initialized variable
trstring variable in spdk_nvme_trid_populate_transport is not initialized, that can lead to snprintf() writes some garbage to trid->trstring if the user passes SPDK_NVME_TRANSPORT_CUSTOM trtype Add return statement and assert to CUSTOM/default switch Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483469 (master) Community-CI: SPDK CI Jenkins <sys_sgci@intel.com> (cherry picked from commit 3424def90a6797e6bc4e634e0e54aa93b33c0b82) Change-Id: I6c6c37f9aa74d61b346f7be27fb890c7a34e9229 Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1318 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
83edd2f716
commit
776d45b0e3
@ -760,7 +760,8 @@ spdk_nvme_trid_populate_transport(struct spdk_nvme_transport_id *trid,
|
||||
case SPDK_NVME_TRANSPORT_CUSTOM:
|
||||
default:
|
||||
SPDK_ERRLOG("don't use this for custom transports\n");
|
||||
break;
|
||||
assert(0);
|
||||
return;
|
||||
}
|
||||
snprintf(trid->trstring, SPDK_NVMF_TRSTRING_MAX_LEN, "%s", trstring);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user