From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.3014.1570869738061362486 for ; Sat, 12 Oct 2019 01:42:18 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: shenglei.zhang@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Oct 2019 01:42:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,287,1566889200"; d="scan'208";a="369649446" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by orsmga005.jf.intel.com with ESMTP; 12 Oct 2019 01:42:17 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sat, 12 Oct 2019 01:42:16 -0700 Received: from shsmsx106.ccr.corp.intel.com ([169.254.10.119]) by SHSMSX151.ccr.corp.intel.com ([10.239.6.50]) with mapi id 14.03.0439.000; Sat, 12 Oct 2019 16:42:15 +0800 From: "Zhang, Shenglei" To: "Fu, Siyuan" , "devel@edk2.groups.io" CC: "Wu, Jiaxin" Subject: Re: [PATCH] NetworkPkg/DpcDxe: Update the consequent logic when DpcEntry is NULL Thread-Topic: [PATCH] NetworkPkg/DpcDxe: Update the consequent logic when DpcEntry is NULL Thread-Index: AQHVgNCwMLRmqoKuf0KSDOqdluGJDadWozaAgAALNlA= Date: Sat, 12 Oct 2019 08:42:14 +0000 Message-ID: References: <20191012074302.11928-1-shenglei.zhang@intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: shenglei.zhang@intel.com Content-Language: en-US Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Fu, Siyuan > Sent: Saturday, October 12, 2019 3:59 PM > To: Zhang, Shenglei ; devel@edk2.groups.io > Cc: Wu, Jiaxin > Subject: RE: [PATCH] NetworkPkg/DpcDxe: Update the consequent logic > when DpcEntry is NULL >=20 > > -----Original Message----- > > From: Zhang, Shenglei > > Sent: 2019=1B$BG/=1B(B10=1B$B7n=1B(B12=1B$BF|=1B(B 15:43 > > To: devel@edk2.groups.io > > Cc: Fu, Siyuan ; Wu, Jiaxin > > 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 > > Cc: Jiaxin Wu > > Signed-off-by: Shenglei Zhang > > --- > > 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_RES= OURCES. > > // > > if (DpcEntry =3D=3D NULL) { > > - if (IsListEmpty (&mDpcEntryFreeList)) { > > - ReturnStatus =3D EFI_OUT_OF_RESOURCES; > > - goto Done; > > - } > > + ReturnStatus =3D EFI_OUT_OF_RESOURCES; > > + goto Done; >=20 > I don't think it's a correct fix. This DpcEntry allocation is inside a fo= r loop which > tries to allocate 64 new DPC entries, if one of the allocation in the mid= dle 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. >=20 > How do you find this issue? By code review or it cause some real problems= ? >=20 It is my local tool that reported this issue. You are right so I will find = another method to fix this. Thanks, Shenglei > Thanks > Siyuan >=20 > > } > > > > // > > -- > > 2.18.0.windows.1