summaryrefslogtreecommitdiffstats
path: root/MdePkg/Library
diff options
context:
space:
mode:
authorJiaxin Wu <jiaxin.wu@intel.com>2017-03-24 09:53:50 +0800
committerJiaxin Wu <jiaxin.wu@intel.com>2017-03-30 11:32:24 +0800
commit7571a1c191e19b48d33a33c8b7763b49999700ee (patch)
treeb31dd096c51041a70e45b44c2bc16597132bb8d8 /MdePkg/Library
parenteed4585ba5915733a88fbb69d565c5e3247753f2 (diff)
downloadedk2-7571a1c191e19b48d33a33c8b7763b49999700ee.tar.gz
edk2-7571a1c191e19b48d33a33c8b7763b49999700ee.tar.bz2
edk2-7571a1c191e19b48d33a33c8b7763b49999700ee.zip
MdePkg/UefiDevicePathLib: Refine the DevPathFromTextiSCSI protocol parsing
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") == 0) { ISCSIDevPath->NetworkProtocol = 0; } else { // // Undefined and reserved. // ISCSIDevPath->NetworkProtocol = 1; } Cc: Warner Losh <imp@bsdimp.com> Cc: Ye Ting <ting.ye@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> Reviewed-by: Warner Losh <imp@bsdimp.com>
Diffstat (limited to 'MdePkg/Library')
-rw-r--r--MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index 3c9df289b6..4322b6c0f2 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -2581,7 +2581,14 @@ DevPathFromTextiSCSI (
ISCSIDevPath->LoginOption = (UINT16) Options;
- ISCSIDevPath->NetworkProtocol = (UINT16) StrCmp (ProtocolStr, L"TCP");
+ if (StrCmp (ProtocolStr, L"TCP") == 0) {
+ ISCSIDevPath->NetworkProtocol = 0;
+ } else {
+ //
+ // Undefined and reserved.
+ //
+ ISCSIDevPath->NetworkProtocol = 1;
+ }
return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath;
}