From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 4E22F81F6C for ; Wed, 14 Dec 2016 23:52:10 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga104.jf.intel.com with ESMTP; 14 Dec 2016 23:51:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,350,1477983600"; d="scan'208";a="1082087507" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga001.fm.intel.com with ESMTP; 14 Dec 2016 23:51:59 -0800 Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 14 Dec 2016 23:51:59 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 14 Dec 2016 23:51:59 -0800 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.11]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.77]) with mapi id 14.03.0248.002; Thu, 15 Dec 2016 15:51:55 +0800 From: "Wu, Jiaxin" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Fu, Siyuan" , "Ye, Ting" Thread-Topic: [PATCH 5/6] MdeModulePkg/UefiPxeBcDxe: Refine the CvtNum function logic Thread-Index: AQHSVf0GlyuSqnG9ykurPRhBw/eSHKEIpBvA Date: Thu, 15 Dec 2016 07:51:55 +0000 Message-ID: <895558F6EA4E3B41AC93A00D163B72741627F62C@SHSMSX103.ccr.corp.intel.com> References: <1481714811-12568-1-git-send-email-hao.a.wu@intel.com> <1481714811-12568-6-git-send-email-hao.a.wu@intel.com> In-Reply-To: <1481714811-12568-6-git-send-email-hao.a.wu@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMGQxMzg5YTMtZDJjNS00MTU0LTliZDQtMjMxNjE4ZDBkNWNmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6IlQ2M3Btc2R3TlRhdktBeXNjU2hlODJUdzdCRzErMHByZ3pia0o2UlFrVnM9In0= x-ctpclassification: CTP_IC x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH 5/6] MdeModulePkg/UefiPxeBcDxe: Refine the CvtNum function 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:10 -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 5/6] MdeModulePkg/UefiPxeBcDxe: Refine the CvtNum > function logic >=20 > This commit refines the logic for the CvtNum function. It avoids using th= e > decrement operator '--' for array index to prevent possible mis-reports b= y > 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 > --- > MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c | 5 ++-- > - > 1 file changed, 2 insertions(+), 3 deletions(-) >=20 > diff --git > a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c > b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c > index 0865ddd..0779056 100644 > --- a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c > +++ b/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c > @@ -132,11 +132,10 @@ CvtNum ( > { > UINTN Remainder; >=20 > - while (Length > 0) { > + for (; Length > 0; Length--) { > Remainder =3D Number % 10; > Number /=3D 10; > - Length--; > - Buffer[Length] =3D (UINT8) ('0' + Remainder); > + Buffer[Length - 1] =3D (UINT8) ('0' + Remainder); > } > } >=20 > -- > 1.9.5.msysgit.0