From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com []) by mx.groups.io with SMTP id smtpd.web11.5643.1572445636099601571 for ; Wed, 30 Oct 2019 07:27:20 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: shenglei.zhang@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Oct 2019 07:27:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,247,1569308400"; d="scan'208";a="203895394" Received: from shenglei-dev.ccr.corp.intel.com ([10.239.158.52]) by orsmga006.jf.intel.com with ESMTP; 30 Oct 2019 07:27:19 -0700 From: "Zhang, Shenglei" To: devel@edk2.groups.io Cc: Hao A Wu , Liming Gao Subject: [PATCH v2 3/4] MdeModulePkg/EsrtDxe: Add check for EsrtRepository Date: Wed, 30 Oct 2019 22:27:09 +0800 Message-Id: <20191030142710.42756-4-shenglei.zhang@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 In-Reply-To: <20191030142710.42756-1-shenglei.zhang@intel.com> References: <20191030142710.42756-1-shenglei.zhang@intel.com> EsrtRepository might be NULL. So return EFI_OUT_OF_RESOURCES when it is NULL. Cc: Hao A Wu Cc: Liming Gao Signed-off-by: Shenglei Zhang Reviewed-by: Hao A Wu --- MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c b/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c index f48125382dbc..fff17b98fa3d 100644 --- a/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c +++ b/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c @@ -239,6 +239,11 @@ DeleteEsrtEntry( goto EXIT; } + if (EsrtRepository == NULL) { + Status = EFI_OUT_OF_RESOURCES; + goto EXIT; + } + if ((RepositorySize % sizeof(EFI_SYSTEM_RESOURCE_ENTRY)) != 0) { DEBUG((EFI_D_ERROR, "Repository Corrupt. Need to rebuild Repository.\n")); // @@ -332,6 +337,11 @@ UpdateEsrtEntry( &RepositorySize ); + if (EsrtRepository == NULL) { + Status = EFI_OUT_OF_RESOURCES; + goto EXIT; + } + if (!EFI_ERROR(Status)) { // // if exist, update Esrt cache repository -- 2.18.0.windows.1