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/DpcDxe: Update the consequent logic when DpcEntry is NULL
Date: Sat, 12 Oct 2019 07:58:45 +0000	[thread overview]
Message-ID: <B1FF2E9001CE9041BD10B825821D5BC58B898AE6@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <20191012074302.11928-1-shenglei.zhang@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/DpcDxe: Update the consequent logic when
> DpcEntry is NULL
> 
> If DpcEntry is NULL, it means it failed to be allocated space.
> ReturnStatus should be EFI_OUT_OF_RESOURCES regardless of the
> content of mDpcEntryFreeList.
> 
> Cc: Siyuan Fu <siyuan.fu@intel.com>
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
> ---
>  NetworkPkg/DpcDxe/Dpc.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/NetworkPkg/DpcDxe/Dpc.c b/NetworkPkg/DpcDxe/Dpc.c
> index 8a490949dc8c..ebdb978b254a 100644
> --- a/NetworkPkg/DpcDxe/Dpc.c
> +++ b/NetworkPkg/DpcDxe/Dpc.c
> @@ -137,14 +137,11 @@ DpcQueueDpc (
>        gBS->RaiseTPL (TPL_HIGH_LEVEL);
> 
>        //
> -      // If the allocation of a DPC entry fails, and the free list is empty,
> -      // then return EFI_OUT_OF_RESOURCES.
> +      // If the allocation of a DPC entry fails, return EFI_OUT_OF_RESOURCES.
>        //
>        if (DpcEntry == NULL) {
> -        if (IsListEmpty (&mDpcEntryFreeList)) {
> -          ReturnStatus = EFI_OUT_OF_RESOURCES;
> -          goto Done;
> -        }
> +        ReturnStatus = EFI_OUT_OF_RESOURCES;
> +        goto Done;

I don't think it's a correct fix. This DpcEntry allocation is inside a for loop which
tries to allocate 64 new DPC entries, if one of the allocation in the middle of
this loop failed, the mDpcEntryFreeList will contain useable entries for this
DpcQueueDpc(), that's why original code doesn't treat it as an error.

How do you find this issue? By code review or it cause some real problems?

Thanks
Siyuan

>        }
> 
>        //
> --
> 2.18.0.windows.1


  parent reply	other threads:[~2019-10-12  7:58 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
2019-10-14  9:46   ` [edk2-devel] " Philippe Mathieu-Daudé
2019-10-12  7:58 ` Siyuan, Fu [this message]
2019-10-12  8:42   ` [PATCH] NetworkPkg/DpcDxe: Update the consequent logic when DpcEntry is NULL 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=B1FF2E9001CE9041BD10B825821D5BC58B898AE6@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