From: "Ni, Ruiyu" <ruiyu.ni@Intel.com>
To: edk2-devel@lists.01.org
Subject: Re: [Patch 2/2] BaseTools: Fix byte orders when handling 8-byte array
Date: Sat, 3 Mar 2018 15:47:24 +0800 [thread overview]
Message-ID: <853c4e80-392d-5558-a0b3-d9bb6fd45c7e@Intel.com> (raw)
In-Reply-To: <1520062536-14244-2-git-send-email-yonghong.zhu@intel.com>
On 3/3/2018 3:35 PM, Yonghong Zhu wrote:
> Per UEFI spec, FibreEx.WWN, FibreEx.Lun, SasEx.Address, SasEx.Lun
The commit message is wrong.
> 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.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
> ---
> BaseTools/Source/C/DevicePath/DevicePathFromText.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/BaseTools/Source/C/DevicePath/DevicePathFromText.c b/BaseTools/Source/C/DevicePath/DevicePathFromText.c
> index 776cf05..f2c0b3c 100644
> --- a/BaseTools/Source/C/DevicePath/DevicePathFromText.c
> +++ b/BaseTools/Source/C/DevicePath/DevicePathFromText.c
> @@ -2385,10 +2385,11 @@ DevPathFromTextiSCSI (
> CHAR16 *DataDigestStr;
> CHAR16 *AuthenticationStr;
> CHAR16 *ProtocolStr;
> CHAR8 *AsciiStr;
> ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
> + UINT64 Lun;
>
> NameStr = GetNextParamStr (&TextDeviceNode);
> PortalGroupStr = GetNextParamStr (&TextDeviceNode);
> LunStr = GetNextParamStr (&TextDeviceNode);
> HeaderDigestStr = GetNextParamStr (&TextDeviceNode);
> @@ -2403,11 +2404,12 @@ DevPathFromTextiSCSI (
>
> AsciiStr = ISCSIDevPath->TargetName;
> 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) {
> Options |= 0x0002;
> }
>
--
Thanks,
Ray
next prev parent reply other threads:[~2018-03-03 7:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-03 7:35 [Patch 1/2] BaseTools: Fix bug when converting iSCSI node Yonghong Zhu
2018-03-03 7:35 ` [Patch 2/2] BaseTools: Fix byte orders when handling 8-byte array Yonghong Zhu
2018-03-03 7:47 ` Ni, Ruiyu [this message]
2018-03-03 7:38 ` [Patch 1/2] BaseTools: Fix bug when converting iSCSI node Gao, Liming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=853c4e80-392d-5558-a0b3-d9bb6fd45c7e@Intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox