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>
\r
ISCSIDevPath->LoginOption = (UINT16) Options;\r
\r
- ISCSIDevPath->NetworkProtocol = (UINT16) StrCmp (ProtocolStr, L"TCP");\r
+ if (StrCmp (ProtocolStr, L"TCP") == 0) {\r
+ ISCSIDevPath->NetworkProtocol = 0;\r
+ } else {\r
+ //\r
+ // Undefined and reserved.\r
+ //\r
+ ISCSIDevPath->NetworkProtocol = 1;\r
+ }\r
\r
return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath;\r
}\r