From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=michael.d.kinney@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 042BB21157FED for ; Thu, 27 Sep 2018 08:03:23 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Sep 2018 08:03:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,311,1534834800"; d="scan'208";a="76485697" Received: from orsmsx108.amr.corp.intel.com ([10.22.240.6]) by orsmga007.jf.intel.com with ESMTP; 27 Sep 2018 08:03:22 -0700 Received: from orsmsx115.amr.corp.intel.com (10.22.240.11) by ORSMSX108.amr.corp.intel.com (10.22.240.6) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 27 Sep 2018 08:03:22 -0700 Received: from orsmsx113.amr.corp.intel.com ([169.254.9.89]) by ORSMSX115.amr.corp.intel.com ([169.254.4.116]) with mapi id 14.03.0319.002; Thu, 27 Sep 2018 08:03:22 -0700 From: "Kinney, Michael D" To: "Li, Songpeng" , "edk2-devel@lists.01.org" , "Kinney, Michael D" CC: "Fu, Siyuan" , "Wu, Jiaxin" , "Gao, Liming" Thread-Topic: [edk2] [PATCH] MdePkg/UefiDevicePathLib: Fix print logic in DevPathToTextiSCSI Thread-Index: AQHUVjUIxfsdvgvFiE2dj7PRMh9jr6UEOSRA Date: Thu, 27 Sep 2018 15:03:22 +0000 Message-ID: References: <20180927073704.15152-1-songpeng.li@intel.com> In-Reply-To: <20180927073704.15152-1-songpeng.li@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.22.254.138] MIME-Version: 1.0 Subject: Re: [PATCH] MdePkg/UefiDevicePathLib: Fix print logic in DevPathToTextiSCSI X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Sep 2018 15:03:24 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Why divide by sizeof(UINT8)? sizeof() always returns the size in bytes. Index is type UINTN, so it will always be >=3D0, 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 ; Wu, Jiaxin > ; Gao, Liming > > Subject: [edk2] [PATCH] MdePkg/UefiDevicePathLib: Fix > print logic in DevPathToTextiSCSI >=20 > In DevPathToTextiSCSI(), ISCSIDevPath->Lun is printed > in reversed orders. >=20 > Ref: > https://bugzilla.tianocore.org/show_bug.cgi?id=3D1216 > Cc: Fu Siyuan > Cc: Wu Jiaxin > Cc: Liming Gao > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Songpeng Li > --- > MdePkg/Library/UefiDevicePathLib/DevicePathToText.c | > 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > 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 =3D 0; Index < sizeof (ISCSIDevPath->Lun) / > sizeof (UINT8); Index++) { > + for (Index =3D sizeof (ISCSIDevPath->Lun) / sizeof > (UINT8) - 1; Index >=3D 0; Index--) { > UefiDevicePathLibCatPrint (Str, L"%02x", ((UINT8 > *)&ISCSIDevPath->Lun)[Index]); > } > Options =3D ISCSIDevPath->LoginOption; > -- > 2.18.0.windows.1 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel