public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Siyuan, Fu" <siyuan.fu@intel.com>
To: "Zhang, Shenglei" <shenglei.zhang@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Wu, Jiaxin" <jiaxin.wu@intel.com>
Subject: Re: [PATCH] NetworkPkg/DxeNetLib: Change the order of conditions in IF statement
Date: Mon, 14 Oct 2019 02:21:22 +0000	[thread overview]
Message-ID: <B1FF2E9001CE9041BD10B825821D5BC58B89AD7E@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20191012074302.11928-2-shenglei.zhang@intel.com>

Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>

> -----Original Message-----
> From: Zhang, Shenglei <shenglei.zhang@intel.com>
> Sent: 2019年10月12日 15:43
> To: devel@edk2.groups.io
> Cc: Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
> Subject: [PATCH] NetworkPkg/DxeNetLib: Change the order of conditions in
> IF statement
> 
> The condition, NET_HEADSPACE(&(Nbuf->BlockOp[Index])) < Len, is
> meaningless
> if Index < 0. So 'Index < 0' should be performed first in the if statement.
> 
> Cc: Siyuan Fu <siyuan.fu@intel.com>
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
>  NetworkPkg/Library/DxeNetLib/NetBuffer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/NetworkPkg/Library/DxeNetLib/NetBuffer.c
> b/NetworkPkg/Library/DxeNetLib/NetBuffer.c
> index 2408e9a10456..a35e67aa1f6c 100644
> --- a/NetworkPkg/Library/DxeNetLib/NetBuffer.c
> +++ b/NetworkPkg/Library/DxeNetLib/NetBuffer.c
> @@ -1063,7 +1063,7 @@ NetbufAllocSpace (
>      } else {
>        NetbufGetByte (Nbuf, 0, &Index);
> 
> -      if ((NET_HEADSPACE(&(Nbuf->BlockOp[Index])) < Len) && (Index > 0)) {
> +      if ((Index > 0) && (NET_HEADSPACE(&(Nbuf->BlockOp[Index])) < Len)) {
>          Index--;
>        }
>      }
> --
> 2.18.0.windows.1


  reply	other threads:[~2019-10-14  2:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-12  7:43 [PATCH] NetworkPkg/DpcDxe: Update the consequent logic when DpcEntry is NULL Zhang, Shenglei
2019-10-12  7:43 ` [PATCH] NetworkPkg/DxeNetLib: Change the order of conditions in IF statement Zhang, Shenglei
2019-10-14  2:21   ` Siyuan, Fu [this message]
2019-10-14  9:46   ` [edk2-devel] " Philippe Mathieu-Daudé
2019-10-12  7:58 ` [PATCH] NetworkPkg/DpcDxe: Update the consequent logic when DpcEntry is NULL Siyuan, Fu
2019-10-12  8:42   ` Zhang, Shenglei

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=B1FF2E9001CE9041BD10B825821D5BC58B89AD7E@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