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 D7654D804CC for ; Tue, 26 Sep 2023 06:40:18 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=fUK01OovRkCCvErrRV2w1ZFe4sKs8RFtYx9sVVlofNo=; 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=1695710417; v=1; b=vx/WsIpwW3IWxecSeKw9kXE5gDbbSYEC1maYsVvQZKt4bGR0muO7jqGKISzkeCqqFCpYgRfV CDzbVfYknQerYp/VEoqSVWUfTbYshCuADnO5WvyWQh1n2pVptiY2ofOJc4Vg8yfoBdk/3HVz8ex Ggyppq5vjsjpqiMJ4MaDJ4DE= X-Received: by 127.0.0.2 with SMTP id HGSHYY7687511xNjBUZzVEyF; Mon, 25 Sep 2023 23:40:17 -0700 X-Received: from mail-vk1-f180.google.com (mail-vk1-f180.google.com [209.85.221.180]) by mx.groups.io with SMTP id smtpd.web11.13059.1695710417015843020 for ; Mon, 25 Sep 2023 23:40:17 -0700 X-Received: by mail-vk1-f180.google.com with SMTP id 71dfb90a1353d-49a319c9e17so1338980e0c.1 for ; Mon, 25 Sep 2023 23:40:16 -0700 (PDT) X-Gm-Message-State: 8bn9uewXyveIQyqBXPMBSWPFx7686176AA= X-Google-Smtp-Source: AGHT+IHjJKGnNiF22WhNDQVrOWVw3TL7wSefBu+6fsxFSUbqdjCxhUtX+mVeMdHXPPAI8+NTZGAEqA== X-Received: by 2002:a05:6102:3bd5:b0:452:988d:b1c9 with SMTP id a21-20020a0561023bd500b00452988db1c9mr4440015vsv.16.1695710415647; Mon, 25 Sep 2023 23:40:15 -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.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 23:40:15 -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 5/5] MdeModulePkg/Core/Dxe: Fix UNUSED_VALUE Coverity issues Date: Tue, 26 Sep 2023 12:09:58 +0530 Message-Id: <20230926063958.313858-6-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="vx/WsIpw"; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none The return value after calls to functions CoreProcessFvImageFile, CoreStartImage, CoreGetDepexSectionAndPreProccess, CoreInternalAddMemorySpace, CoreAddIoSpace, CoreAllocateMemorySpace and CoreCloseProtocol is stored in Status, but it is not made of any use and later Status gets overridden. One option assuming this is deliberate, would be to remove the return value storage in Status. Otherwise, simply add appropriate debug messages conditionally. 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/Dispatcher/Dispatcher.c | 15 +++++++++++++++ MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 15 +++++++++++++++ MdeModulePkg/Core/Dxe/Image/Image.c | 3 +++ 3 files changed, 33 insertions(+) diff --git a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c b/MdeModulePkg/C= ore/Dxe/Dispatcher/Dispatcher.c index cf9d55687766..f53a2513457a 100644 --- a/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c +++ b/MdeModulePkg/Core/Dxe/Dispatcher/Dispatcher.c @@ -506,6 +506,10 @@ CoreDispatcher ( // Produce a firmware volume block protocol for FvImage so it gets= dispatched from.=0D //=0D Status =3D CoreProcessFvImageFile (DriverEntry->Fv, DriverEntry->F= vHandle, &DriverEntry->FileName);=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_DISPATCH, "Failed to produce a FVB protocol for Fv= %p FvHandle %p and FileName %g.\n",=0D + DriverEntry->Fv, DriverEntry->FvHandle, &DriverEntry->FileName= ));=0D + }=0D } else {=0D REPORT_STATUS_CODE_WITH_EXTENDED_DATA (=0D EFI_PROGRESS_CODE,=0D @@ -516,6 +520,10 @@ CoreDispatcher ( ASSERT (DriverEntry->ImageHandle !=3D NULL);=0D =0D Status =3D CoreStartImage (DriverEntry->ImageHandle, NULL, NULL);= =0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_DISPATCH, "Failed to transfer control to a loaded = image's entry point for ImageHandle %p.\n",=0D + DriverEntry->ImageHandle));=0D + }=0D =0D REPORT_STATUS_CODE_WITH_EXTENDED_DATA (=0D EFI_PROGRESS_CODE,=0D @@ -549,6 +557,13 @@ CoreDispatcher ( // If Section Extraction Protocol did not let the Depex be read be= fore retry the read=0D //=0D Status =3D CoreGetDepexSectionAndPreProccess (DriverEntry);=0D + if (EFI_ERROR (Status)) {=0D + if (Status =3D=3D EFI_PROTOCOL_ERROR) {=0D + DEBUG ((DEBUG_DISPATCH, "Section extraction protocol failure f= or DriverEntry %p.\n", DriverEntry));=0D + } else {=0D + DEBUG ((DEBUG_DISPATCH, "No Depex, assume UEFI 2.0 driver mode= l for DriverEntry %p.\n", DriverEntry));=0D + }=0D + }=0D }=0D =0D if (DriverEntry->Dependent) {=0D diff --git a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c b/MdeModulePkg/Core/Dxe/Gcd/Gc= d.c index 39fa2adf9366..384fee600d85 100644 --- a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c +++ b/MdeModulePkg/Core/Dxe/Gcd/Gcd.c @@ -2638,6 +2638,9 @@ CoreInitializeGcdServices ( ResourceHob->ResourceLength,=0D Capabilities=0D );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_GCD, "Failed to add a segment of memory to GCD map= , Status =3D %r\n", Status));=0D + }=0D }=0D =0D if (GcdIoType !=3D EfiGcdIoTypeNonExistent) {=0D @@ -2646,6 +2649,9 @@ CoreInitializeGcdServices ( ResourceHob->PhysicalStart,=0D ResourceHob->ResourceLength=0D );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_GCD, "Failed to add reserved I/O or I/O resources,= Status =3D %r\n", Status));=0D + }=0D }=0D }=0D }=0D @@ -2668,6 +2674,9 @@ CoreInitializeGcdServices ( gDxeCoreImageHandle,=0D NULL=0D );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_GCD, "Failed to allocate memory space, Status =3D %r\n= ", Status));=0D + }=0D }=0D =0D //=0D @@ -2715,6 +2724,9 @@ CoreInitializeGcdServices ( gDxeCoreImageHandle,=0D NULL=0D );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_GCD, "Failed to allocate memory space, Status =3D %r= \n", Status));=0D + }=0D }=0D }=0D =0D @@ -2763,6 +2775,9 @@ CoreInitializeGcdServices ( gDxeCoreImageHandle,=0D NULL=0D );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_GCD, "Failed to allocate memory space, Status =3D = %r\n", Status));=0D + }=0D }=0D }=0D }=0D diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Im= age/Image.c index 9dbfb2a1fad2..769e2d379051 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -1010,6 +1010,9 @@ CoreUnloadAndCloseImage ( Image->Handle,=0D OpenInfo[OpenInfoIndex].ControllerHandle=0D );=0D + if (EFI_ERROR (Status)) {=0D + DEBUG ((DEBUG_WARN, "Failed to close protocol on Handl= e %p\n", HandleBuffer[HandleIndex]));=0D + }=0D }=0D }=0D =0D --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109064): https://edk2.groups.io/g/devel/message/109064 Mute This Topic: https://groups.io/mt/101590758/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-