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 Change-Id: I6c6c37f9aa74d61b346f7be27fb890c7a34e9229 Signed-off-by: Alexey Marchuk <alexeymar@mellanox.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483469 Community-CI: SPDK CI Jenkins <sys_sgci@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Seth Howell <seth.howell@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
03e96be67d
commit
3424def90a
@ -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…
Reference in New Issue
Block a user