libefivar: 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;
}
Obtained from: 7571a1c191
Pull Request: https://github.com/freebsd/freebsd-src/pull/581
This commit is contained in:
parent
b782b7884c
commit
7ca6daff6a
@ -2725,7 +2725,14 @@ DevPathFromTextiSCSI (
|
|||||||
|
|
||||||
ISCSIDevPath->LoginOption = (UINT16) Options;
|
ISCSIDevPath->LoginOption = (UINT16) Options;
|
||||||
|
|
||||||
ISCSIDevPath->NetworkProtocol = (UINT16) StrCmp (ProtocolStr, "TCP");
|
if (StrCmp (ProtocolStr, "TCP") == 0) {
|
||||||
|
ISCSIDevPath->NetworkProtocol = 0;
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// Undefined and reserved.
|
||||||
|
//
|
||||||
|
ISCSIDevPath->NetworkProtocol = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath;
|
return (EFI_DEVICE_PATH_PROTOCOL *) ISCSIDevPath;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user