diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-03-02 23:07:06 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2018-03-04 09:25:26 +0800 |
commit | c3ac218240fc0a24b610b074b880dc3302e94e14 (patch) | |
tree | 4715ad5b71776372593e9c77f73dcd13a06a4257 /BaseTools | |
parent | 97cf199254111610a7aeac43dce4ce75e6eac5c2 (diff) | |
download | edk2-c3ac218240fc0a24b610b074b880dc3302e94e14.tar.gz edk2-c3ac218240fc0a24b610b074b880dc3302e94e14.tar.bz2 edk2-c3ac218240fc0a24b610b074b880dc3302e94e14.zip |
BaseTools: Fix byte orders when handling 8-byte array
Per UEFI spec, FibreEx.WWN, FibreEx.Lun, SasEx.Address, SasEx.Lun
and iSCSI.Lun are all 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.
The patch fixes this issue by using StrHexToBytes().
Copy this solution from MdePkg Hash version d0196be.
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
(cherry picked from commit 27db236ac2beefc8a2de4c0df07ab47374aacfc3)
Diffstat (limited to 'BaseTools')
-rw-r--r-- | BaseTools/Source/C/DevicePath/DevicePathFromText.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/BaseTools/Source/C/DevicePath/DevicePathFromText.c b/BaseTools/Source/C/DevicePath/DevicePathFromText.c index fd310c7d0f..bfd91d23b5 100644 --- a/BaseTools/Source/C/DevicePath/DevicePathFromText.c +++ b/BaseTools/Source/C/DevicePath/DevicePathFromText.c @@ -2387,6 +2387,7 @@ DevPathFromTextiSCSI ( CHAR16 *ProtocolStr;
CHAR8 *AsciiStr;
ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
+ UINT64 Lun;
NameStr = GetNextParamStr (&TextDeviceNode);
PortalGroupStr = GetNextParamStr (&TextDeviceNode);
@@ -2405,7 +2406,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, L"CRC32C") == 0) {
|