From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (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 7A49681EAC for ; Wed, 14 Dec 2016 23:33:19 -0800 (PST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 14 Dec 2016 23:33:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,350,1477983600"; d="scan'208";a="1082082517" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by fmsmga001.fm.intel.com with ESMTP; 14 Dec 2016 23:33:19 -0800 Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 14 Dec 2016 23:33:18 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 14 Dec 2016 23:33:18 -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:33:15 +0800 From: "Ye, Ting" To: "Wu, Hao A" , "edk2-devel@lists.01.org" CC: "Fu, Siyuan" , "Wu, Jiaxin" Thread-Topic: [PATCH 5/6] MdeModulePkg/UefiPxeBcDxe: Refine the CvtNum function logic Thread-Index: AQHSVf0GqoCQicWsmkyKuuQFIg5bnqEInvow Date: Thu, 15 Dec 2016 07:33:14 +0000 Message-ID: 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: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: 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:33:19 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ye Ting -----Original Message----- From: Wu, Hao A=20 Sent: Wednesday, December 14, 2016 7:27 PM To: edk2-devel@lists.01.org Cc: Wu, Hao A ; Fu, Siyuan ; Ye, T= ing ; Wu, Jiaxin Subject: [PATCH 5/6] MdeModulePkg/UefiPxeBcDxe: Refine the CvtNum function = logic This commit refines the logic for the CvtNum function. It avoids using the = decrement operator '--' for array index to prevent possible mis-reports by = static code checkers. 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(-) diff --git a/MdeModulePkg/Universal/Network/UefiPxeBcDxe/PxeBcSupport.c b/M= deModulePkg/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