git: 7ca6daff6a43 - main - libefivar: Refine the DevPathFromTextiSCSI protocol parsing
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 27 Feb 2022 16:47:36 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=7ca6daff6a43f11fb93831e0970fb8bfb5d0833a
commit 7ca6daff6a43f11fb93831e0970fb8bfb5d0833a
Author: Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-02-24 01:43:27 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-02-27 16:12:18 +0000
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: https://github.com/tianocore/edk2/commit/7571a1c191e19b48d33a33c8b7763b49999700ee
Pull Request: https://github.com/freebsd/freebsd-src/pull/581
---
lib/libefivar/efivar-dp-parse.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/libefivar/efivar-dp-parse.c b/lib/libefivar/efivar-dp-parse.c
index 82f9c6027d32..02c32971f4c6 100644
--- a/lib/libefivar/efivar-dp-parse.c
+++ b/lib/libefivar/efivar-dp-parse.c
@@ -2725,7 +2725,14 @@ DevPathFromTextiSCSI (
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;
}