From nobody Sat Nov 2 10:19:58 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1490337858877535.2129887169394; Thu, 23 Mar 2017 23:44:18 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7B7308044A; Thu, 23 Mar 2017 23:44:16 -0700 (PDT) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 8E885802B6 for ; Thu, 23 Mar 2017 23:44:15 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Mar 2017 23:44:15 -0700 Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.108]) by orsmga003.jf.intel.com with ESMTP; 23 Mar 2017 23:44:13 -0700 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490337855; x=1521873855; h=from:to:cc:subject:date:message-id; bh=yoiUp0DuX0mKkn3A1OSYZCSnSofbpaDZwLZEtyv/VZs=; b=N1/zxRWSjXwVhJIDZhW+K02a4tAliSXvZtbpQL/vJ0AoUQ8Vb3vaiFMH swHNKf3dbtWo6F894IOfPP24zy4sJQ==; X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,213,1486454400"; d="scan'208";a="947715959" From: Jiaxin Wu To: edk2-devel@lists.01.org Date: Fri, 24 Mar 2017 14:44:12 +0800 Message-Id: <1490337852-7104-1-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [Patch] MdePkg/UefiDevicePathLib: Refine the DevPathFromTextiSCSI protocol parsing X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ye Ting , Fu Siyuan , Wu Jiaxin , Liming Gao , Warner Losh MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" For current iSCSI protocol parsing, UINT16 truncation may be happened. Since the Spec already have declaimed that 0 is TCP Protocol and 1+ is reserved, = the parsing can be refined as below: if (StrCmp (ProtocolStr, L"TCP") =3D=3D 0) { ISCSIDevPath->NetworkProtocol =3D 0; } else { // // Undefined and reserved. // ISCSIDevPath->NetworkProtocol =3D 1; } Cc: Warner Losh Cc: Liming Gao Cc: Ye Ting Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin --- MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg= /Library/UefiDevicePathLib/DevicePathFromText.c index 3c9df28..4322b6c 100644 --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c @@ -2579,11 +2579,18 @@ DevPathFromTextiSCSI ( Options |=3D 0x1000; } =20 ISCSIDevPath->LoginOption =3D (UINT16) Options; =20 - ISCSIDevPath->NetworkProtocol =3D (UINT16) StrCmp (ProtocolStr, L"TCP"); + if (StrCmp (ProtocolStr, L"TCP") =3D=3D 0) { + ISCSIDevPath->NetworkProtocol =3D 0; + } else { + // + // Undefined and reserved. + // + ISCSIDevPath->NetworkProtocol =3D 1; + } =20 return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath; } =20 /** --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel