[edk2-devel] [PATCH v2] NetworkPkg/DxeNetLib: Change the order of conditions in IF statement
Philippe Mathieu-Daudé
philmd at redhat.com
Wed May 20 11:41:01 UTC 2020
On 5/20/20 5:08 AM, Zhang, Shenglei wrote:
> 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 at linux.intel.com>
> Cc: Siyuan Fu <siyuan.fu at intel.com>
> Cc: Jiaxin Wu <jiaxin.wu at intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang at intel.com>
> ---
>
> v2: Update 'Index > 0' to 'Index != 0'
>
> 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 a232802c9a21..329a17623d94 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)) {
Reviewed-by: Philippe Mathieu-Daude <philmd at redhat.com>
> Index--;
> }
> }
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#59958): https://edk2.groups.io/g/devel/message/59958
Mute This Topic: https://groups.io/mt/74341614/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list