From: "Wu, Jiaxin" <jiaxin.wu@intel.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Fu, Siyuan" <siyuan.fu@intel.com>, "Ye, Ting" <ting.ye@intel.com>
Subject: Re: [PATCH 6/6] NetworkPkg: Refine UintnToAscDecWithFormat functions logic
Date: Thu, 15 Dec 2016 07:52:37 +0000 [thread overview]
Message-ID: <895558F6EA4E3B41AC93A00D163B72741627F650@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1481714811-12568-7-git-send-email-hao.a.wu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
> -----Original Message-----
> From: Wu, Hao A
> Sent: Wednesday, December 14, 2016 7:27 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Ye,
> Ting <ting.ye@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
> Subject: [PATCH 6/6] NetworkPkg: Refine UintnToAscDecWithFormat
> functions logic
>
> 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.
>
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> Cc: Ye Ting <ting.ye@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
> NetworkPkg/HttpBootDxe/HttpBootSupport.c | 5 ++---
> NetworkPkg/UefiPxeBcDxe/PxeBcSupport.c | 5 ++---
> 2 files changed, 4 insertions(+), 6 deletions(-)
>
> 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;
>
> - while (Length > 0) {
> - Length--;
> + for (; Length > 0; Length--) {
> Remainder = Number % 10;
> Number /= 10;
> - Buffer[Length] = (UINT8) ('0' + Remainder);
> + Buffer[Length - 1] = (UINT8) ('0' + Remainder);
> }
> }
>
> 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;
>
> - while (Length > 0) {
> - Length--;
> + for (; Length > 0; Length--) {
> Remainder = Number % 10;
> Number /= 10;
> - Buffer[Length] = (UINT8) ('0' + Remainder);
> + Buffer[Length - 1] = (UINT8) ('0' + Remainder);
> }
> }
>
> --
> 1.9.5.msysgit.0
next prev parent reply other threads:[~2016-12-15 7:52 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-14 11:26 [PATCH 0/6] Refine code logics to prevent possible mis-reports by static code checkers Hao Wu
2016-12-14 11:26 ` [PATCH 1/6] MdePkg/BaseLib: Refine (Ascii)StrnLenS functions logic Hao Wu
2016-12-15 23:54 ` Kinney, Michael D
2016-12-16 3:21 ` Wu, Hao A
2016-12-14 11:26 ` [PATCH 2/6] MdePkg/BaseLib: Add an additional check within (Ascii)StrnCmp Hao Wu
2016-12-15 23:54 ` Kinney, Michael D
2016-12-14 11:26 ` [PATCH 3/6] MdePkg/MemoryLib: Refine InternalMemSetMem16|32|64 functions logic Hao Wu
2016-12-15 23:55 ` Kinney, Michael D
2016-12-14 11:26 ` [PATCH 4/6] MdeModulePkg/DxeNetLib: Rewrite NetblockChecksum function logic Hao Wu
2016-12-15 2:45 ` Fu, Siyuan
2016-12-15 7:41 ` Ye, Ting
2016-12-15 7:51 ` Wu, Jiaxin
2016-12-14 11:26 ` [PATCH 5/6] MdeModulePkg/UefiPxeBcDxe: Refine the CvtNum " Hao Wu
2016-12-15 2:47 ` Fu, Siyuan
2016-12-15 7:33 ` Ye, Ting
2016-12-15 7:51 ` Wu, Jiaxin
2016-12-14 11:26 ` [PATCH 6/6] NetworkPkg: Refine UintnToAscDecWithFormat functions logic Hao Wu
2016-12-15 2:47 ` Fu, Siyuan
2016-12-15 7:32 ` Ye, Ting
2016-12-15 7:52 ` Wu, Jiaxin [this message]
2016-12-18 3:04 ` [PATCH 0/6] Refine code logics to prevent possible mis-reports by static code checkers Heyi Guo
2016-12-20 8:14 ` Wu, Hao A
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=895558F6EA4E3B41AC93A00D163B72741627F650@SHSMSX103.ccr.corp.intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox