From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by ml01.01.org (Postfix) with ESMTP id 54AD11A1E6B for ; Tue, 2 Aug 2016 00:11:56 -0700 (PDT) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 02 Aug 2016 00:11:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,459,1464678000"; d="scan'208";a="1018071417" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga001.fm.intel.com with ESMTP; 02 Aug 2016 00:11:45 -0700 Received: from fmsmsx124.amr.corp.intel.com (10.18.125.39) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 2 Aug 2016 00:11:44 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by fmsmsx124.amr.corp.intel.com (10.18.125.39) with Microsoft SMTP Server (TLS) id 14.3.248.2; Tue, 2 Aug 2016 00:11:43 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.8]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.116]) with mapi id 14.03.0248.002; Tue, 2 Aug 2016 15:11:42 +0800 From: "Tian, Feng" To: "Gao, Liming" , "edk2-devel@lists.01.org" CC: "Tian, Feng" Thread-Topic: [edk2] [Patch] MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access Thread-Index: AQHR7IAv6t4do8PG4kqvF+/cYO9lNaA1QSUA Date: Tue, 2 Aug 2016 07:11:40 +0000 Message-ID: <7F1BAD85ADEA444D97065A60D2E97EE53881FA32@SHSMSX101.ccr.corp.intel.com> References: <1470116318-5600-1-git-send-email-liming.gao@intel.com> In-Reply-To: <1470116318-5600-1-git-send-email-liming.gao@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [Patch] MdeModulePkg LoadFileOnFv2: Fix the potential NULL pointer access X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Aug 2016 07:11:56 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Feng Tian Thanks Feng -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Limi= ng Gao Sent: Tuesday, August 2, 2016 1:39 PM To: edk2-devel@lists.01.org Subject: [edk2] [Patch] MdeModulePkg LoadFileOnFv2: Fix the potential NULL = pointer access Check NULL pointer before access it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Liming Gao --- MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c b/MdeModu= lePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c index 9eea50d..18a07d8 100644 --- a/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c +++ b/MdeModulePkg/Universal/LoadFileOnFv2/LoadFileOnFv2.c @@ -345,6 +345,9 @@ FvNotificationEvent ( Index =3D 0; BufferSize =3D sizeof (EFI_HANDLE); Handle =3D AllocateZeroPool (BufferSize); + if (Handle =3D=3D NULL) { + return; + } Status =3D gBS->LocateHandle ( ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, @@ -355,6 +358,9 @@ = FvNotificationEvent ( if (EFI_BUFFER_TOO_SMALL =3D=3D Status) { FreePool (Handle); Handle =3D AllocateZeroPool (BufferSize); + if (Handle =3D=3D NULL) { + return; + } Status =3D gBS->LocateHandle ( ByProtocol, &gEfiFirmwareVolume2ProtocolGuid, -- 2.8.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel