From nobody Sun Feb 8 22:07:17 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+106995+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+106995+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1689670924; cv=none; d=zohomail.com; s=zohoarc; b=gDPyauZd8eGI+O3wV7qqAAZToUQgg5Oz6MJexwJmSXvt+hhXVcFua4j1iW3pGJKbnxGHUnBh8Zlk/OZQ4LkuMCONCj9KSdGrAElWhN/UQTss5SJxEFqXT+qPg+Oe9mROD66tQ15KBVoLeOEjKlScPK6PuWuMwFCJTKTLT+kSPt0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689670924; 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=W5Ry44hhufALJB3SvFyZYcJdM4/nv3nHVmmUrFurjrU=; b=n8uTzPHhhRkBzxhU7bi8r17+6BNdjXpFTh362s1VwLCIL6Jlm4J4+lcUp3GJ7KGEKBEarBOKX3Z2AlAeVnnk9uLoUUhvJ9hGGU6y3DCrUHDnJXQ0YXSea1Wb9R/LXtFc069ir4hAmOk6sgVEJwCw95rJgs1OSmUMNNdhrG7qlag= 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+106995+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 168967092465476.91016742655381; Tue, 18 Jul 2023 02:02:04 -0700 (PDT) Return-Path: DKIM-Signature: a=rsa-sha256; bh=09wotRRfEj0V2lFkqp8Q64Vvl6u+t5TXONcZQCNf3yM=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Gm-Message-State:X-Google-Smtp-Source:X-Received:X-Received:From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:Content-Transfer-Encoding; s=20140610; t=1689670924; v=1; b=Tcnn4jXRirL0PUmu0uLWvJkm6sxG6Ym0cMYhrte30WRvLtFfSXHDYGid19wicVTOQkFE1q8I NmCm5+VbgaeGv7ICEm3kvvMPBH0dqwT0Mo3hAGIU/Nzr9jpajnwxpAnOOq/98MUiA0SwJkIzXB2 Hk0LSf5a2hrulmcl4NdfPz1U= X-Received: by 127.0.0.2 with SMTP id 85xlYY1788612xi5CXJ7Wjr3; Tue, 18 Jul 2023 02:02:04 -0700 X-Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) by mx.groups.io with SMTP id smtpd.web10.5971.1689593920791735746 for ; Mon, 17 Jul 2023 04:38:40 -0700 X-Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-6686c74183cso4485280b3a.1 for ; Mon, 17 Jul 2023 04:38:40 -0700 (PDT) X-Gm-Message-State: 1atC4jgY2DykIgWsU2FWamPPx1787277AA= X-Google-Smtp-Source: APBJJlEqpho8olFyaibRrQk61YHiYifHortfz7RgK7vbHhtBBEMo/IreuSkeeeimYcgZkUnF5HaHvQ== X-Received: by 2002:a05:6a00:2e98:b0:662:5146:c761 with SMTP id fd24-20020a056a002e9800b006625146c761mr17507414pfb.17.1689593920192; Mon, 17 Jul 2023 04:38:40 -0700 (PDT) X-Received: from user-Latitude-5420.dc1.ventanamicro.com ([2401:4900:1cbd:8dd2:c2bf:93e0:5979:e5e0]) by smtp.gmail.com with ESMTPSA id a23-20020a637f17000000b0055b3af821d5sm12667349pgd.25.2023.07.17.04.38.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 04:38:40 -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 2/2] MdeModulePkg/Bus/Pci/UhciDxe: Fix FORWARD_NULL Coverity issues Date: Mon, 17 Jul 2023 17:08:31 +0530 Message-Id: <20230717113831.2290882-3-rsingh@ventanamicro.com> In-Reply-To: <20230717113831.2290882-1-rsingh@ventanamicro.com> References: <20230717113831.2290882-1-rsingh@ventanamicro.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1689670925754100018 Content-Type: text/plain; charset="utf-8" From: Ranbir Singh The function UsbHcGetPciAddressForHostMem has ASSERT ((Block !=3D NULL)); and and the function UsbHcFreeMem has ASSERT (Block !=3D NULL); statement after for loop, but these are applicable only in DEBUG mode. In RELEASE mode, if for whatever reasons there is no match inside for loop and the loop exits because of Block !=3D NULL; condition, then there is no "Block" NULL pointer check afterwards and the code proceeds to do dereferencing "Block" which will lead to CRASH. Hence, for safety add NULL pointer checks always. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4211 Cc: Hao A Wu Cc: Ray Ni Co-authored-by: Veeresh Sangolli Signed-off-by: Ranbir Singh Signed-off-by: Ranbir Singh Reviewed-by: Hao A Wu --- MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c b/MdeModulePkg/Bus/Pci= /UhciDxe/UsbHcMem.c index c3d46f60bed5..3794f888e132 100644 --- a/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c +++ b/MdeModulePkg/Bus/Pci/UhciDxe/UsbHcMem.c @@ -250,6 +250,11 @@ UsbHcGetPciAddressForHostMem ( } =20 ASSERT ((Block !=3D NULL)); + + if (Block =3D=3D NULL) { + return 0; + } + // // calculate the pci memory address for host memory address. // @@ -536,6 +541,10 @@ UsbHcFreeMem ( // ASSERT (Block !=3D NULL); =20 + if (Block =3D=3D NULL) { + return; + } + // // Release the current memory block if it is empty and not the head // --=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 (#106995): https://edk2.groups.io/g/devel/message/106995 Mute This Topic: https://groups.io/mt/100212110/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-