From nobody Thu Mar 28 20:13:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45252+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45252+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1565315629; cv=none; d=zoho.com; s=zohoarc; b=SG/sli3kH2vTZFLQckC8MYtnBN73o8CLWqIW74jM8PGhjbPTaFPwbhg6DOQ1mt602cK+MLMCLXtiCLsoFd1xCM+0U6XwNa1KsZPIXUZSgdwFavxyILLmDqCVaWMGbRIx/KzrF76YxQY4lxlWq1ZLlTyZqBMwZEfqkjEYSJQpI40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565315629; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=Xk8atn7BqA76xk0XQaMymYsQMoQMHq99m2jA185TSqU=; b=lF3d2nsIGOYkhBmxjW/G57La5sjK+QyY34/PM8CWCBqLuG9nKmeHhswIGAHyBltWuiuaCJFtUvseeT1qpVwxhS+Hvj2meKwrRujgMt4TGpNEYL/CQ2f9jikdTi9EceAOcPSQRTLFkUaatxfz45IqAqjVHBnLY2iS3X789ApGjvs= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45252+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565315629351406.18167289365977; Thu, 8 Aug 2019 18:53:49 -0700 (PDT) Return-Path: X-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 X-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" X-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: [edk2-devel] [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> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,star.zeng@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565315629; bh=bnScirznKJfowZSv24yXy4hF2FUegkHc6eJtCTczUYA=; h=Cc:Date:From:Reply-To:Subject:To; b=Frv1WznAyCUtrBUsNCq26aOBmuHd0TAyyQqleaGARgwfyZGpVoK8/DfS3ODmVlfHX7I so/0o+/6cqJsyAvgcj3ZinUdtKXsIFaXUSd5DCtfflT0OXkWJy5KNLqTsd08rqmLYDEGa e8hzmSYMx+OO1sWArKSMRldb+HB1y+2qjiI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2051 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 Reviewed-by: Hao A Wu --- .../DebugCommunicationLibUsb3/DebugCommunicationLibUsb3Dxe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCom= municationLibUsb3Dxe.c b/SourceLevelDebugPkg/Library/DebugCommunicationLibU= sb3/DebugCommunicationLibUsb3Dxe.c index eee30c852ffd..d4245465ce74 100644 --- a/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicat= ionLibUsb3Dxe.c +++ b/SourceLevelDebugPkg/Library/DebugCommunicationLibUsb3/DebugCommunicat= ionLibUsb3Dxe.c @@ -447,7 +447,7 @@ DebugCommunicationUsb3DxeConstructor ( EFI_EVENT Event; =20 Status =3D EfiGetSystemConfigurationTable (&gUsb3DbgGuid, (VOID **) &Add= rPtr); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) || (AddrPtr =3D=3D NULL)) { // // Instead of using local variables, install system configuration tabl= e for // the local instance and the buffer to save instance address pointer. --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45252): https://edk2.groups.io/g/devel/message/45252 Mute This Topic: https://groups.io/mt/32806071/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-