git: acfee0131adb - main - libefivar: Fix byte orders of iSCSI.Lun
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 27 Feb 2022 16:47:42 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=acfee0131adb8bbfb2a2fbe4d17d4e0fae2897d9
commit acfee0131adb8bbfb2a2fbe4d17d4e0fae2897d9
Author: Jose Luis Duran <jlduran@gmail.com>
AuthorDate: 2022-02-24 01:55:30 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-02-27 16:12:47 +0000
libefivar: Fix byte orders of iSCSI.Lun
Per UEFI spec, iSCSI.Lun is a 8-byte array with byte #0 in the left.
It means "0102030405060708" should be converted to:
UINT8[8] = {01, 02, 03, 04, 05, 06, 07, 08}
or UINT64 = {0807060504030201}
Today's implementation wrongly uses the reversed order.
Obtained from: https://github.com/tianocore/edk2/commit/d0196be1e39c419223738d7181d4a5d8972792d0
Pull Request: https://github.com/freebsd/freebsd-src/pull/581
---
lib/libefivar/efivar-dp-parse.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/libefivar/efivar-dp-parse.c b/lib/libefivar/efivar-dp-parse.c
index c527607c7184..5d5d0dfb7baa 100644
--- a/lib/libefivar/efivar-dp-parse.c
+++ b/lib/libefivar/efivar-dp-parse.c
@@ -2686,6 +2686,7 @@ DevPathFromTextiSCSI (
CHAR16 *ProtocolStr;
CHAR8 *AsciiStr;
ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
+ UINT64 Lun;
NameStr = GetNextParamStr (&TextDeviceNode);
PortalGroupStr = GetNextParamStr (&TextDeviceNode);
@@ -2704,7 +2705,8 @@ DevPathFromTextiSCSI (
StrToAscii (NameStr, &AsciiStr);
ISCSIDevPath->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr);
- Strtoi64 (LunStr, &ISCSIDevPath->Lun);
+ Strtoi64 (LunStr, &Lun);
+ WriteUnaligned64 ((UINT64 *) &ISCSIDevPath->Lun, SwapBytes64 (Lun));
Options = 0x0000;
if (StrCmp (HeaderDigestStr, "CRC32C") == 0) {