From nobody Sun Feb 8 17:21:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+109111+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109111+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1695795438; cv=none; d=zohomail.com; s=zohoarc; b=h2zC5kH33lEf2JWsI69XfRy73AqmC8a0CzkCTUpSoHIgHg22Bz7UO4qKFeTYBu+NEtqf73tSrlbK1D44No6BfA8k6PpH5MH7RVJOIR7guW8xO/JGoW+iByM2Wq0VGeek8kj4xRVp29NFWF5RZzmQqnlxJ8W0//qXvtY8/lHD5XQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1695795438; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ZE9xhpl5t2YDgq201+Usqqzsecw7ELM9mn2rvYsTs+I=; b=P8nBbhuFBrGHXjc6XQunb8YBvhjaojDiNNRFVpEFY1y7AZ38o2GbinhBtrH8SeSTx8nSf/TdEmiC2Qw4w2LAdVsow7oXrOjMq2aLMbIUUlTYzAP0gxfWuPcjBFMC7FP4sgqNnBa0w0dmKVv41I96KCAJHcL13soGGbRBa46zJA0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+109111+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1695795438359266.59793850707354; Tue, 26 Sep 2023 23:17:18 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=kxRDzPnxhmpZH4IZft2JLovGsyiEYx19cQL/bexhIrs=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1695795438; v=1; b=bXwV08vZe45WK81IcVdodwuJu3spus0oI/6bJkuXzKXXz7YyXw/UJteJu0kde0PEwWxYr1uV QIWOcIDzF1ASZdqxvjlWL0Lrsxh4Nk3GyGhgJh+uEKMojefi1u+lpYYvToDRSEWSfDqfPEnYWL9 BE/wj9SIrNAA/JXz0ah9+InY= X-Received: by 127.0.0.2 with SMTP id k9YoYY1788612xL5Hd1vfsqY; Tue, 26 Sep 2023 23:17:18 -0700 X-Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) by mx.groups.io with SMTP id smtpd.web10.11692.1695795437434332916 for ; Tue, 26 Sep 2023 23:17:17 -0700 X-Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-79f915e5b47so356663139f.2 for ; Tue, 26 Sep 2023 23:17:17 -0700 (PDT) X-Gm-Message-State: 9VgCyxNFB3iXM5vqs8NE0t5mx1787277AA= X-Google-Smtp-Source: AGHT+IELsGBLrm9faq0hp4PTw25pMs+bgQwqy6+GBNlDPjUnPWhiJPfT9ZON1McfemuraV7OOnyMDA== X-Received: by 2002:a6b:dd07:0:b0:790:fa58:69d2 with SMTP id f7-20020a6bdd07000000b00790fa5869d2mr1008146ioc.20.1695795436530; Tue, 26 Sep 2023 23:17:16 -0700 (PDT) X-Received: from user-Latitude-5420.dc1.ventanamicro.com ([106.51.83.242]) by smtp.gmail.com with ESMTPSA id o23-20020a6b5a17000000b007836c7e8dccsm2571625iob.17.2023.09.26.23.17.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 23:17:16 -0700 (PDT) From: "Ranbir Singh" To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Hao A Wu , Ray Ni , Veeresh Sangolli Subject: [edk2-devel] [PATCH v1 4/5] MdeModulePkg/Bus/Pci/PciBusDxe: Fix NULL_RETURNS Coverity issue Date: Wed, 27 Sep 2023 11:47:00 +0530 Message-Id: <20230927061701.451202-5-rsingh@ventanamicro.com> In-Reply-To: <20230927061701.451202-1-rsingh@ventanamicro.com> References: <20230927061701.451202-1-rsingh@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: 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,rsingh@ventanamicro.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1695795438951100005 Content-Type: text/plain; charset="utf-8" From: Ranbir Singh The function StartPciDevices has a check ASSERT (RootBridge !=3D NULL); but this comes into play only in DEBUG mode. In Release mode, there is no handling if the RootBridge value is NULL and the code proceeds to unconditionally dereference "RootBridge" which will lead to CRASH. Hence, for safety add NULL pointer checks always and return EFI_NOT_READY if RootBridge value is NULL which is one of the return values as mentioned in the function description header. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4239 Cc: Hao A Wu Cc: Ray Ni Co-authored-by: Veeresh Sangolli Signed-off-by: Ranbir Singh Signed-off-by: Ranbir Singh --- MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModuleP= kg/Bus/Pci/PciBusDxe/PciDeviceSupport.c index 581e9075ad41..f43f10325f16 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c @@ -773,6 +773,11 @@ StartPciDevices ( =20 RootBridge =3D GetRootBridgeByHandle (Controller); ASSERT (RootBridge !=3D NULL); + + if (RootBridge =3D=3D NULL) { + return EFI_NOT_READY; + } + ThisHostBridge =3D RootBridge->PciRootBridgeIo->ParentHandle; =20 CurrentLink =3D mPciDevicePool.ForwardLink; --=20 2.34.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 (#109111): https://edk2.groups.io/g/devel/message/109111 Mute This Topic: https://groups.io/mt/101612810/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-