From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (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 0FE8081F87 for ; Wed, 14 Dec 2016 23:52:40 -0800 (PST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga105.jf.intel.com with ESMTP; 14 Dec 2016 23:52:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,350,1477983600"; d="scan'208";a="912426714" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga003.jf.intel.com with ESMTP; 14 Dec 2016 23:52:39 -0800 Received: from fmsmsx153.amr.corp.intel.com (10.18.125.6) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 14 Dec 2016 23:52:39 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX153.amr.corp.intel.com (10.18.125.6) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 14 Dec 2016 23:52:39 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.11]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.235]) with mapi id 14.03.0248.002; Thu, 15 Dec 2016 15:52:37 +0800 From: "Wu, Jiaxin" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Fu, Siyuan" , "Ye, Ting" Thread-Topic: [PATCH 6/6] NetworkPkg: Refine UintnToAscDecWithFormat functions logic Thread-Index: AQHSVf0H7X3nOjesTEWm5PMAjm+1HaEIpEEg Date: Thu, 15 Dec 2016 07:52:37 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B72741627F650@SHSMSX103.ccr.corp.intel.com> References: <1481714811-12568-1-git-send-email-hao.a.wu@intel.com> <1481714811-12568-7-git-send-email-hao.a.wu@intel.com> In-Reply-To: <1481714811-12568-7-git-send-email-hao.a.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOGUwZWFmYjMtZjRiMS00NjU1LWE3MGUtMmRkYWRmY2YwMjM1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImRNcjRaSjk4dVFrdEUwdDZreE9Fdm5DTVpZeUdjdWVcLzdzVFZ6NW41VzRjPSJ9 x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 6/6] NetworkPkg: Refine UintnToAscDecWithFormat functions logic X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Dec 2016 07:52:40 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Wu Jiaxin > -----Original Message----- > From: Wu, Hao A > Sent: Wednesday, December 14, 2016 7:27 PM > To: edk2-devel@lists.01.org > Cc: Wu, Hao A ; Fu, Siyuan ; Ye, > Ting ; Wu, Jiaxin > Subject: [PATCH 6/6] NetworkPkg: Refine UintnToAscDecWithFormat > functions logic >=20 > This commit refines the logic for HttpBootUintnToAscDecWithFormat and > PxeBcUintnToAscDecWithFormat. It avoids using the decrement operator '--' > for array index to prevent possible mis-reports by static code checkers. >=20 > Cc: Fu Siyuan > Cc: Ye Ting > Cc: Wu Jiaxin > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Hao Wu > --- > NetworkPkg/HttpBootDxe/HttpBootSupport.c | 5 ++--- > NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 5 ++--- > 2 files changed, 4 insertions(+), 6 deletions(-) >=20 > diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c > b/NetworkPkg/HttpBootDxe/HttpBootSupport.c > index 9410bf9..bdb29ae 100644 > --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c > +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c > @@ -86,11 +86,10 @@ HttpBootUintnToAscDecWithFormat ( { > UINTN Remainder; >=20 > - while (Length > 0) { > - Length--; > + for (; Length > 0; Length--) { > Remainder =3D Number % 10; > Number /=3D 10; > - Buffer[Length] =3D (UINT8) ('0' + Remainder); > + Buffer[Length - 1] =3D (UINT8) ('0' + Remainder); > } > } >=20 > diff --git a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c > b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c > index 00c652d..568360d 100644 > --- a/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c > +++ b/NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c > @@ -1383,11 +1383,10 @@ PxeBcUintnToAscDecWithFormat ( { > UINTN Remainder; >=20 > - while (Length > 0) { > - Length--; > + for (; Length > 0; Length--) { > Remainder =3D Number % 10; > Number /=3D 10; > - Buffer[Length] =3D (UINT8) ('0' + Remainder); > + Buffer[Length - 1] =3D (UINT8) ('0' + Remainder); > } > } >=20 > -- > 1.9.5.msysgit.0