Commit 09786296 authored by Jacek Kalwas's avatar Jacek Kalwas Committed by Jim Harris
Browse files

nvme: add input val for populate transnsport str

Input validation was removed while ago as part of other fix,
see https://review.spdk.io/gerrit/c/spdk/spdk/+/11709

.

By restoring input validation code is more aligned with other
_populate and _parse public functions.

Without input validation segfault could happen when using nvmf due to
lack of trtype specified for json-rpc methods taking listen_address as
an input. It is possible because curently listen_address decoder do not
mark this argument as required (and doing early validation). It should
change after next release if [listen_]address.transport argument would
be removed eventually.

Change-Id: Ie63b6cadcef41f92ea7d0c67dee00f2df474a4f0
Signed-off-by: default avatarJacek Kalwas <jacek.kalwas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/22916


Reviewed-by: default avatarShuhei Matsumoto <smatsumoto@nvidia.com>
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
parent fa70385d
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1054,6 +1054,10 @@ spdk_nvme_transport_id_populate_trstring(struct spdk_nvme_transport_id *trid, co
{
	int i = 0;

	if (trid == NULL || trstring == NULL) {
		return -EINVAL;
	}

	/* Note: gcc-11 has some false positive -Wstringop-overread warnings with LTO builds if we
	 * use strnlen here.  So do the trstring copy manually instead.  See GitHub issue #2391.
	 */