public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdePkg/UefiDevicePathLib: Fix print logic in DevPathToTextiSCSI
@ 2018-09-27  7:37 Songpeng Li
  2018-09-27  7:51 ` Fu, Siyuan
  2018-09-27 15:03 ` Kinney, Michael D
  0 siblings, 2 replies; 4+ messages in thread
From: Songpeng Li @ 2018-09-27  7:37 UTC (permalink / raw)
  To: edk2-devel; +Cc: Fu Siyuan, Wu Jiaxin, Liming Gao

In DevPathToTextiSCSI(), ISCSIDevPath->Lun is printed in reversed orders.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1216
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Songpeng Li <songpeng.li@intel.com>
---
 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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] MdePkg/UefiDevicePathLib: Fix print logic in DevPathToTextiSCSI
  2018-09-27  7:37 [PATCH] MdePkg/UefiDevicePathLib: Fix print logic in DevPathToTextiSCSI Songpeng Li
@ 2018-09-27  7:51 ` Fu, Siyuan
  2018-09-27  8:09   ` Li, Songpeng
  2018-09-27 15:03 ` Kinney, Michael D
  1 sibling, 1 reply; 4+ messages in thread
From: Fu, Siyuan @ 2018-09-27  7:51 UTC (permalink / raw)
  To: Li, Songpeng, edk2-devel@lists.01.org; +Cc: Wu, Jiaxin, Gao, Liming

Hi, Songpeng

According to the iSCSI text device note in UEFI spec, the byte 0 of LUN should come first, seems there is no problem in original code logic. Could you please double confirm that?
	"The LUN is an 8 byte array that is displayed in hexadecimal format with byte 0 first (i.e., on the left) and byte 7 last (i.e, on the right), and is required."


BestRegards
Fu Siyuan

> -----Original Message-----
> From: Li, Songpeng
> Sent: Thursday, September 27, 2018 3:37 PM
> To: edk2-devel@lists.01.org
> Cc: Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>;
> Gao, Liming <liming.gao@intel.com>
> Subject: [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 <siyuan.fu@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Songpeng Li <songpeng.li@intel.com>
> ---
>  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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MdePkg/UefiDevicePathLib: Fix print logic in DevPathToTextiSCSI
  2018-09-27  7:51 ` Fu, Siyuan
@ 2018-09-27  8:09   ` Li, Songpeng
  0 siblings, 0 replies; 4+ messages in thread
From: Li, Songpeng @ 2018-09-27  8:09 UTC (permalink / raw)
  To: Fu, Siyuan, edk2-devel@lists.01.org; +Cc: Wu, Jiaxin, Gao, Liming

The variable in memory is stored as little endian, so the byte 0 is actually stored in the last byte in memory.


Best,
Songpeng

> -----Original Message-----
> From: Fu, Siyuan
> Sent: Thursday, September 27, 2018 3:51 PM
> To: Li, Songpeng <songpeng.li@intel.com>; edk2-devel@lists.01.org
> Cc: Wu, Jiaxin <jiaxin.wu@intel.com>; Gao, Liming <liming.gao@intel.com>
> Subject: RE: [PATCH] MdePkg/UefiDevicePathLib: Fix print logic in
> DevPathToTextiSCSI
> 
> Hi, Songpeng
> 
> According to the iSCSI text device note in UEFI spec, the byte 0 of LUN should
> come first, seems there is no problem in original code logic. Could you please
> double confirm that?
> 	"The LUN is an 8 byte array that is displayed in hexadecimal format
> with byte 0 first (i.e., on the left) and byte 7 last (i.e, on the right), and is
> required."
> 
> 
> BestRegards
> Fu Siyuan
> 
> > -----Original Message-----
> > From: Li, Songpeng
> > Sent: Thursday, September 27, 2018 3:37 PM
> > To: edk2-devel@lists.01.org
> > Cc: Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>;
> > Gao, Liming <liming.gao@intel.com>
> > Subject: [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 <siyuan.fu@intel.com>
> > Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Songpeng Li <songpeng.li@intel.com>
> > ---
> >  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



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] MdePkg/UefiDevicePathLib: Fix print logic in DevPathToTextiSCSI
  2018-09-27  7:37 [PATCH] MdePkg/UefiDevicePathLib: Fix print logic in DevPathToTextiSCSI Songpeng Li
  2018-09-27  7:51 ` Fu, Siyuan
@ 2018-09-27 15:03 ` Kinney, Michael D
  1 sibling, 0 replies; 4+ messages in thread
From: Kinney, Michael D @ 2018-09-27 15:03 UTC (permalink / raw)
  To: Li, Songpeng, edk2-devel@lists.01.org, Kinney, Michael D
  Cc: Fu, Siyuan, Wu, Jiaxin, Gao, Liming


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-
> bounces@lists.01.org] On Behalf Of Songpeng Li
> Sent: Thursday, September 27, 2018 12:37 AM
> To: edk2-devel@lists.01.org
> Cc: Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin
> <jiaxin.wu@intel.com>; Gao, Liming
> <liming.gao@intel.com>
> 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 <siyuan.fu@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Songpeng Li <songpeng.li@intel.com>
> ---
>  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
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-09-27 15:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-27  7:37 [PATCH] MdePkg/UefiDevicePathLib: Fix print logic in DevPathToTextiSCSI Songpeng Li
2018-09-27  7:51 ` Fu, Siyuan
2018-09-27  8:09   ` Li, Songpeng
2018-09-27 15:03 ` Kinney, Michael D

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox