On 9/17/19 9:49 PM, Laszlo Ersek wrote:
> 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 <dandan...@intel.com>
> Cc: Eric Dong <eric.d...@intel.com>
> Cc: Hao A Wu <hao.a...@intel.com>
> Cc: Jian J Wang <jian.j.w...@intel.com>
> Cc: Liming Gao <liming....@intel.com>
> Cc: Ray Ni <ray...@intel.com>
> Signed-off-by: Laszlo Ersek <ler...@redhat.com>
> ---
> 
> 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/DxeCorePerformanceLib.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, 
> sizeof (ModuleName), &ModuleGuid);
>      StringPtr = ModuleName;
>      //
>      // Cache the offset of start image start record and use to update the 
> start image end record if needed.
> @@ -1031,7 +1031,7 @@ InsertFpdtRecord (
>  
>    case MODULE_LOADIMAGE_START_ID:
>    case MODULE_LOADIMAGE_END_ID:
> -    GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName, 
> sizeof (ModuleName), &ModuleGuid);
> +    GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, 
> sizeof (ModuleName), &ModuleGuid);
>      StringPtr = ModuleName;
>      if (PerfId == 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, 
> sizeof (ModuleName), &ModuleGuid);
>      StringPtr = ModuleName;
>      if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
>        FpdtRecordPtr.GuidQwordEvent->Header.Type           = 
> FPDT_GUID_QWORD_EVENT_TYPE;
> @@ -1085,7 +1085,7 @@ InsertFpdtRecord (
>      break;
>  
>    case MODULE_DB_END_ID:
> -    GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName, 
> sizeof (ModuleName), &ModuleGuid);
> +    GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, 
> sizeof (ModuleName), &ModuleGuid);
>      StringPtr = ModuleName;
>      if (!PcdGetBool (PcdEdkiiFpdtStringRecordEnableOnly)) {
>        FpdtRecordPtr.GuidQwordStringEvent->Header.Type     = 
> 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, 
> sizeof (ModuleName), &ModuleGuid);
>      if (String != NULL) {
>        StringPtr = String;
>      } else {
> @@ -1153,7 +1153,7 @@ InsertFpdtRecord (
>  
>    default:
>      if (Attribute != PerfEntry) {
> -      GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName, 
> sizeof (ModuleName), &ModuleGuid);
> +      GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, 
> sizeof (ModuleName), &ModuleGuid);
>        if (String != NULL) {
>          StringPtr = String;
>        } else {
> diff --git 
> a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLib.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, 
> sizeof (ModuleName), &ModuleGuid);
>      StringPtr = ModuleName;
>      //
>      // Cache the offset of start image start record and use to update the 
> start image end record if needed.
> @@ -612,7 +612,7 @@ InsertFpdtRecord (
>  
>    case MODULE_LOADIMAGE_START_ID:
>    case MODULE_LOADIMAGE_END_ID:
> -    GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName, 
> sizeof (ModuleName), &ModuleGuid);
> +    GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, 
> sizeof (ModuleName), &ModuleGuid);
>      StringPtr = ModuleName;
>      if (PerfId == 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, 
> sizeof (ModuleName), &ModuleGuid);
>      if (String != NULL) {
>        StringPtr = String;
>      } else {
> @@ -691,7 +691,7 @@ InsertFpdtRecord (
>  
>    default:
>      if (Attribute != PerfEntry) {
> -      GetModuleInfoFromHandle ((EFI_HANDLE *)CallerIdentifier, ModuleName, 
> sizeof (ModuleName), &ModuleGuid);
> +      GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, ModuleName, 
> sizeof (ModuleName), &ModuleGuid);
>        if (String != NULL) {
>          StringPtr = String;
>        } else {
> 

Reviewed-by: Philippe Mathieu-Daude <phi...@redhat.com>

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#47917): https://edk2.groups.io/g/devel/message/47917
Mute This Topic: https://groups.io/mt/34180207/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to