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: d0196be1e3
Pull Request: https://github.com/freebsd/freebsd-src/pull/581
This commit is contained in:
parent
76ed5f1b26
commit
acfee0131a
@ -2686,6 +2686,7 @@ DevPathFromTextiSCSI (
|
|||||||
CHAR16 *ProtocolStr;
|
CHAR16 *ProtocolStr;
|
||||||
CHAR8 *AsciiStr;
|
CHAR8 *AsciiStr;
|
||||||
ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
|
ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
|
||||||
|
UINT64 Lun;
|
||||||
|
|
||||||
NameStr = GetNextParamStr (&TextDeviceNode);
|
NameStr = GetNextParamStr (&TextDeviceNode);
|
||||||
PortalGroupStr = GetNextParamStr (&TextDeviceNode);
|
PortalGroupStr = GetNextParamStr (&TextDeviceNode);
|
||||||
@ -2704,7 +2705,8 @@ DevPathFromTextiSCSI (
|
|||||||
StrToAscii (NameStr, &AsciiStr);
|
StrToAscii (NameStr, &AsciiStr);
|
||||||
|
|
||||||
ISCSIDevPath->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr);
|
ISCSIDevPath->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr);
|
||||||
Strtoi64 (LunStr, &ISCSIDevPath->Lun);
|
Strtoi64 (LunStr, &Lun);
|
||||||
|
WriteUnaligned64 ((UINT64 *) &ISCSIDevPath->Lun, SwapBytes64 (Lun));
|
||||||
|
|
||||||
Options = 0x0000;
|
Options = 0x0000;
|
||||||
if (StrCmp (HeaderDigestStr, "CRC32C") == 0) {
|
if (StrCmp (HeaderDigestStr, "CRC32C") == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user