From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: redhat.com, ip: 209.132.183.28, mailfrom: lersek@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Tue, 17 Sep 2019 12:50:00 -0700 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 168343086211; Tue, 17 Sep 2019 19:50:00 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-37.rdu2.redhat.com [10.10.120.37]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38210600C4; Tue, 17 Sep 2019 19:49:58 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: Dandan Bi , Eric Dong , Hao A Wu , Jian J Wang , Liming Gao , Ray Ni Subject: [PATCH 07/35] MdeModulePkg: fix cast in GetModuleInfoFromHandle() calls Date: Tue, 17 Sep 2019 21:49:07 +0200 Message-Id: <20190917194935.24322-8-lersek@redhat.com> In-Reply-To: <20190917194935.24322-1-lersek@redhat.com> References: <20190917194935.24322-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Tue, 17 Sep 2019 19:50:00 +0000 (UTC) Content-Transfer-Encoding: quoted-printable GetModuleInfoFromHandle() takes an EFI_HANDLE -- (VOID*) -- as first parameter, but InsertFpdtRecord() passes (EFI_HANDLE*) -- (VOID**). (VOID**) converts silently to (VOID*), which is why the wrong cast is masked. Note that the *value* that is passed is alright -- therefore this patch does not change behavior --, it's just semantically wrong to pass an (EFI_HANDLE*) where an EFI_HANDLE is expected. Cc: Dandan Bi Cc: Eric Dong Cc: Hao A Wu Cc: Jian J Wang Cc: Liming Gao Cc: Ray Ni Signed-off-by: Laszlo Ersek --- Notes: lightly tested, as DxeCorePerformanceLib is linked into ArmVirtQemu's DxeCore MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c | 12 = ++++++------ MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c | 8 = ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanc= eLib.c b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib= .c index 0d507c445210..f500e20b320b 100644 --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c @@ -998,7 +998,7 @@ InsertFpdtRecord ( switch (PerfId) { case MODULE_START_ID: case MODULE_END_ID: - GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName,= sizeof (ModuleName), &ModuleGuid); + GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, s= izeof (ModuleName), &ModuleGuid); StringPtr =3D ModuleName; // // Cache the offset of start image start record and use to update th= e start image end record if needed. @@ -1031,7 +1031,7 @@ InsertFpdtRecord ( =20 case MODULE_LOADIMAGE_START_ID: case MODULE_LOADIMAGE_END_ID: - GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName,= sizeof (ModuleName), &ModuleGuid); + GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, s= izeof (ModuleName), &ModuleGuid); StringPtr =3D ModuleName; if (PerfId =3D=3D MODULE_LOADIMAGE_START_ID) { mLoadImageCount ++; @@ -1071,7 +1071,7 @@ InsertFpdtRecord ( case MODULE_DB_SUPPORT_END_ID: case MODULE_DB_STOP_START_ID: case MODULE_DB_STOP_END_ID: - GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName,= sizeof (ModuleName), &ModuleGuid); + GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, s= izeof (ModuleName), &ModuleGuid); StringPtr =3D ModuleName; if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) { FpdtRecordPtr.GuidQwordEvent->Header.Type =3D FPDT_GUID_= QWORD_EVENT_TYPE; @@ -1085,7 +1085,7 @@ InsertFpdtRecord ( break; =20 case MODULE_DB_END_ID: - GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName,= sizeof (ModuleName), &ModuleGuid); + GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, s= izeof (ModuleName), &ModuleGuid); StringPtr =3D ModuleName; if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) { FpdtRecordPtr.GuidQwordStringEvent->Header.Type =3D FPDT_GUID_= QWORD_STRING_EVENT_TYPE; @@ -1131,7 +1131,7 @@ InsertFpdtRecord ( case PERF_INMODULE_END_ID: case PERF_CROSSMODULE_START_ID: case PERF_CROSSMODULE_END_ID: - GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName,= sizeof (ModuleName), &ModuleGuid); + GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, s= izeof (ModuleName), &ModuleGuid); if (String !=3D NULL) { StringPtr =3D String; } else { @@ -1153,7 +1153,7 @@ InsertFpdtRecord ( =20 default: if (Attribute !=3D PerfEntry) { - GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleNam= e, sizeof (ModuleName), &ModuleGuid); + GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName,= sizeof (ModuleName), &ModuleGuid); if (String !=3D NULL) { StringPtr =3D String; } else { diff --git a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanc= eLib.c b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib= .c index 5f07464c4ec7..b4f22c14ae73 100644 --- a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c +++ b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.c @@ -587,7 +587,7 @@ InsertFpdtRecord ( switch (PerfId) { case MODULE_START_ID: case MODULE_END_ID: - GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName,= sizeof (ModuleName), &ModuleGuid); + GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, s= izeof (ModuleName), &ModuleGuid); StringPtr =3D ModuleName; // // Cache the offset of start image start record and use to update th= e start image end record if needed. @@ -612,7 +612,7 @@ InsertFpdtRecord ( =20 case MODULE_LOADIMAGE_START_ID: case MODULE_LOADIMAGE_END_ID: - GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName,= sizeof (ModuleName), &ModuleGuid); + GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, s= izeof (ModuleName), &ModuleGuid); StringPtr =3D ModuleName; if (PerfId =3D=3D MODULE_LOADIMAGE_START_ID) { mLoadImageCount++; @@ -669,7 +669,7 @@ InsertFpdtRecord ( case PERF_INMODULE_END_ID: case PERF_CROSSMODULE_START_ID: case PERF_CROSSMODULE_END_ID: - GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName,= sizeof (ModuleName), &ModuleGuid); + GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, s= izeof (ModuleName), &ModuleGuid); if (String !=3D NULL) { StringPtr =3D String; } else { @@ -691,7 +691,7 @@ InsertFpdtRecord ( =20 default: if (Attribute !=3D PerfEntry) { - GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleNam= e, sizeof (ModuleName), &ModuleGuid); + GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName,= sizeof (ModuleName), &ModuleGuid); if (String !=3D NULL) { StringPtr =3D String; } else { --=20 2.19.1.3.g30247aa5d201