From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.126, mailfrom: star.zeng@intel.com) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by groups.io with SMTP; Thu, 08 Aug 2019 18:53:48 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Aug 2019 18:53:47 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,363,1559545200"; d="scan'208";a="175026824" Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.158.70]) by fmsmga008.fm.intel.com with ESMTP; 08 Aug 2019 18:53:47 -0700 From: "Zeng, Star" To: devel@edk2.groups.io Cc: Star Zeng , Hao A Wu Subject: [PATCH] SourceLevelDebugPkg DebugCommLibUsb3: Address NULL ptr dereference case Date: Fri, 9 Aug 2019 09:53:45 +0800 Message-Id: <20190809015345.63500-1-star.zeng@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2051 Original code GetConfigTable for AddrPtr first, if failed, InstalConfigTable with allocated AddrPtr. So the AddrPtr should not be NULL and the NULL pointer dereference case should be false positive. This patch is just to address the case raised from static analysis. Cc: Hao A Wu Signed-off-by: Star Zeng --- .../DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c index eee30c852ffd..d4245465ce74 100644 --- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c +++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c @@ -447,7 +447,7 @@ DebugCommunicationUsb3DxeConstructor ( EFI_EVENT Event; Status = EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) &AddrPtr); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) || (AddrPtr == NULL)) { // // Instead of using local variables, install system configuration table for // the local instance and the buffer to save instance address pointer. -- 2.21.0.windows.1