summaryrefslogtreecommitdiffstats
path: root/NetworkPkg
diff options
context:
space:
mode:
authorZhang, Shenglei <shenglei.zhang@intel.com>2020-05-20 11:08:47 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-05-20 12:44:43 +0000
commitd3733188a2162abf72dd08c0cedd1119b5cfe6c4 (patch)
tree4a3d41ca9c58002d8fc4c7ac6c372369423edd22 /NetworkPkg
parent7b6327ff03bb4436261ffad246ba3a14de10391f (diff)
downloadedk2-d3733188a2162abf72dd08c0cedd1119b5cfe6c4.tar.gz
edk2-d3733188a2162abf72dd08c0cedd1119b5cfe6c4.tar.bz2
edk2-d3733188a2162abf72dd08c0cedd1119b5cfe6c4.zip
NetworkPkg/DxeNetLib: Change the order of conditions in IF statement
The condition, NET_HEADSPACE(&(Nbuf->BlockOp[Index])) < Len, is meaningless if Index = 0. So checking 'Index != 0' should be performed first in the if statement. Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com> Cc: Siyuan Fu <siyuan.fu@intel.com> Cc: Jiaxin Wu <jiaxin.wu@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com> Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
Diffstat (limited to 'NetworkPkg')
-rw-r--r--NetworkPkg/Library/DxeNetLib/NetBuffer.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/NetworkPkg/Library/DxeNetLib/NetBuffer.c b/NetworkPkg/Library/DxeNetLib/NetBuffer.c
index a232802c9a..329a17623d 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--;
}
}