Why divide by sizeof(UINT8)?  sizeof() always returns the size in bytes.

Index is type UINTN, so it will always be >=0, so I do
think the loop will ever exit.

Mike

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-
> [email protected]] On Behalf Of Songpeng Li
> Sent: Thursday, September 27, 2018 12:37 AM
> To: [email protected]
> Cc: Fu, Siyuan <[email protected]>; Wu, Jiaxin
> <[email protected]>; Gao, Liming
> <[email protected]>
> Subject: [edk2] [PATCH] MdePkg/UefiDevicePathLib: Fix
> print logic in DevPathToTextiSCSI
> 
> In DevPathToTextiSCSI(), ISCSIDevPath->Lun is printed
> in reversed orders.
> 
> Ref:
> https://bugzilla.tianocore.org/show_bug.cgi?id=1216
> Cc: Fu Siyuan <[email protected]>
> Cc: Wu Jiaxin <[email protected]>
> Cc: Liming Gao <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Songpeng Li <[email protected]>
> ---
>  MdePkg/Library/UefiDevicePathLib/DevicePathToText.c |
> 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git
> a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> index 7d8d304f6f..3f6478e43c 100644
> ---
> a/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> +++
> b/MdePkg/Library/UefiDevicePathLib/DevicePathToText.c
> @@ -1548,7 +1548,7 @@ DevPathToTextiSCSI (
>      ISCSIDevPath->TargetName,
>      ISCSIDevPath->TargetPortalGroupTag
>      );
> -  for (Index = 0; Index < sizeof (ISCSIDevPath->Lun) /
> sizeof (UINT8); Index++) {
> +  for (Index = sizeof (ISCSIDevPath->Lun) / sizeof
> (UINT8) - 1; Index >= 0; Index--) {
>      UefiDevicePathLibCatPrint (Str, L"%02x", ((UINT8
> *)&ISCSIDevPath->Lun)[Index]);
>    }
>    Options = ISCSIDevPath->LoginOption;
> --
> 2.18.0.windows.1
> 
> _______________________________________________
> edk2-devel mailing list
> [email protected]
> https://lists.01.org/mailman/listinfo/edk2-devel
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to