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...@intel.com> Cc: Jiaxin Wu <jiaxin...@intel.com> Signed-off-by: Shenglei Zhang <shenglei.zh...@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 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#48863): https://edk2.groups.io/g/devel/message/48863 Mute This Topic: https://groups.io/mt/34508855/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-