From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: michael.d.kinney@intel.com) Received: from mga17.intel.com (mga17.intel.com []) by groups.io with SMTP; Wed, 10 Jul 2019 12:05:21 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jul 2019 12:05:21 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,475,1557212400"; d="scan'208";a="171008199" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.241.98.74]) by orsmga006.jf.intel.com with ESMTP; 10 Jul 2019 12:05:20 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Zailiang Sun , Yi Qian , Gary Lin Subject: [edk2-platforms Patch 17/28] Vlvt2TbltDevicePkg: Fix NULL pointer access in SmbiosMiscDxe Date: Wed, 10 Jul 2019 12:05:05 -0700 Message-Id: <20190710190516.6012-18-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190710190516.6012-1-michael.d.kinney@intel.com> References: <20190710190516.6012-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Handle case where no Simple Network Protocols are found. Cc: Zailiang Sun Cc: Yi Qian Cc: Gary Lin Signed-off-by: Michael D Kinney --- .../MiscBaseBoardManufacturerFunction.c | 14 +++++++++----- .../SmBiosMiscDxe/MiscSystemManufacturerFunction.c | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c index 4e02486853..8eddc5c2a6 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscBaseBoardManufacturerFunction.c @@ -130,11 +130,15 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) // //Get the MAC string // - Status = NetLibGetMacString ( - *Handles, - NULL, - &MacStr - ); + if (Handles == NULL) { + Status = EFI_NOT_FOUND; + } else { + Status = NetLibGetMacString ( + *Handles, + NULL, + &MacStr + ); + } if (EFI_ERROR (Status)) { MacStr = L"000000000000"; } diff --git a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c index da660cb3a8..b18dbd6ae2 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/SmBiosMiscDxe/MiscSystemManufacturerFunction.c @@ -212,11 +212,15 @@ AddSmbiosManuCallback ( // //Get the MAC string // - Status = NetLibGetMacString ( - *Handles, - NULL, - &MacStr - ); + if (Handles == NULL) { + Status = EFI_NOT_FOUND; + } else { + Status = NetLibGetMacString ( + *Handles, + NULL, + &MacStr + ); + } if (EFI_ERROR (Status)) { MacStr = L"000000000000"; } -- 2.21.0.windows.1