diff options
author | Zhang, Shenglei <shenglei.zhang@intel.com> | 2020-05-20 11:08:47 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-05-20 12:44:43 +0000 |
commit | d3733188a2162abf72dd08c0cedd1119b5cfe6c4 (patch) | |
tree | 4a3d41ca9c58002d8fc4c7ac6c372369423edd22 | |
parent | 7b6327ff03bb4436261ffad246ba3a14de10391f (diff) | |
download | edk2-d3733188a2162abf72dd08c0cedd1119b5cfe6c4.zip edk2-d3733188a2162abf72dd08c0cedd1119b5cfe6c4.tar.gz edk2-d3733188a2162abf72dd08c0cedd1119b5cfe6c4.tar.bz2 |
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>
-rw-r--r-- | NetworkPkg/Library/DxeNetLib/NetBuffer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/NetworkPkg/Library/DxeNetLib/NetBuffer.c b/NetworkPkg/Library/DxeNetLib/NetBuffer.c index a232802..329a176 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--;
}
}
|