From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id B9FC0AC0CDA for ; Tue, 26 Sep 2023 06:40:08 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=wUxim76iuMkG/X5+VBoECg+9naKCrU1QNTpNcEDfNCw=; 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=1695710407; v=1; b=VPBfxpzEFtDkYri4+Abor4CS5KviTH+LclyqMmLKrKkmFkILdOGx9GLru0C4D7zCEkZ5jAoT uOjriFUzuzEs7U4NzXdukRxnalxMHRmbCuZ+mP3+/5H0u9oRH8leU8PguzlNBt1OleE0nJeyfbe yzNU/ykiVVpQOzWQbiiq2ecU= X-Received: by 127.0.0.2 with SMTP id Fi15YY7687511xSGnRI5f153; Mon, 25 Sep 2023 23:40:07 -0700 X-Received: from mail-ot1-f41.google.com (mail-ot1-f41.google.com [209.85.210.41]) by mx.groups.io with SMTP id smtpd.web11.13052.1695710406914798972 for ; Mon, 25 Sep 2023 23:40:07 -0700 X-Received: by mail-ot1-f41.google.com with SMTP id 46e09a7af769-6bf298ef1f5so5113838a34.0 for ; Mon, 25 Sep 2023 23:40:06 -0700 (PDT) X-Gm-Message-State: VRpee6i2geWo0xHQDeui2VWXx7686176AA= X-Google-Smtp-Source: AGHT+IESx6I0g0wQy59Sk+OaSgBHu/s1Ihv+ylPMICZyJSmzBJcxy7TXxYxCdH/U6afagfMrFjHZmw== X-Received: by 2002:a05:6358:341a:b0:134:c859:d32a with SMTP id h26-20020a056358341a00b00134c859d32amr11301541rwd.25.1695710405900; Mon, 25 Sep 2023 23:40:05 -0700 (PDT) X-Received: from user-Latitude-5420.. ([2401:4900:1cbc:99f:aeba:67ec:3f47:cb02]) by smtp.gmail.com with ESMTPSA id q9-20020a639809000000b00573f82bb00esm8875606pgd.2.2023.09.25.23.40.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 23:40:05 -0700 (PDT) From: "Ranbir Singh" To: devel@edk2.groups.io, rsingh@ventanamicro.com Cc: Dandan Bi , Liming Gao , Veeresh Sangolli Subject: [edk2-devel] [PATCH v1 1/5] MdeModulePkg/Core/Dxe: Fix FORWARD_NULL Coverity issues Date: Tue, 26 Sep 2023 12:09:54 +0530 Message-Id: <20230926063958.313858-2-rsingh@ventanamicro.com> In-Reply-To: <20230926063958.313858-1-rsingh@ventanamicro.com> References: <20230926063958.313858-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-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=VPBfxpzE; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io From: Ranbir Singh The functions CoreConvertSpace and CoreAllocateSpace in MdeModulePkg/Core/Dxe/Gcd/Gcd.c has ASSERT (FALSE); at lines 755 and 1155 which gets hit when Operation neither include GCD_MEMORY_SPACE_OPERATION nor include GCD_IO_SPACE_OPERATION but this comes into play only in DEBUG mode. In Release mode, the code continues to proceed in this undesirable case with Map variable still set to NULL and hence dereferencing "Map" will lead to CRASH. It is safer to add a debug message in this scenario and return from the function with EFI_INVALID_PARAMETER; The existing ASSERT may be retained or may be deleted whatever is deemed more appropriate. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4219 Cc: Dandan Bi Cc: Liming Gao Co-authored-by: Veeresh Sangolli Signed-off-by: Ranbir Singh Signed-off-by: Ranbir Singh --- MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gc= d.c index 792cd2e0af23..39fa2adf9366 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -752,7 +752,9 @@ CoreConvertSpace ( CoreAcquireGcdIoLock ();=0D Map =3D &mGcdIoSpaceMap;=0D } else {=0D + DEBUG ((DEBUG_GCD, " Status =3D %r\n", EFI_INVALID_PARAMETER));=0D ASSERT (FALSE);=0D + return EFI_INVALID_PARAMETER;=0D }=0D =0D //=0D @@ -1152,7 +1154,9 @@ CoreAllocateSpace ( CoreAcquireGcdIoLock ();=0D Map =3D &mGcdIoSpaceMap;=0D } else {=0D + DEBUG ((DEBUG_GCD, " Status =3D %r\n", EFI_INVALID_PARAMETER));=0D ASSERT (FALSE);=0D + return EFI_INVALID_PARAMETER;=0D }=0D =0D Found =3D FALSE;=0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109060): https://edk2.groups.io/g/devel/message/109060 Mute This Topic: https://groups.io/mt/101590754/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-