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: philmd@redhat.com) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by groups.io with SMTP; Tue, 24 Sep 2019 03:43:24 -0700 Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4264B3D966 for ; Tue, 24 Sep 2019 10:43:23 +0000 (UTC) Received: by mail-wm1-f70.google.com with SMTP id s25so647869wmh.1 for ; Tue, 24 Sep 2019 03:43:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=THpDcNvWLAxH8G3lYisie0T2GaJTJukgXviJivuJBQI=; b=IL0oUYPphOridAufvh4dry0uGFXEdPtiBp8fy/3jaNKXEHRfwbk/A9xLaTO4V399DN GRKqribZG7qI3+EjQjasGRBt/8RlspCmjf/GVDnzX+twd5rASZ3uIoHryETRkOCdp0xD KLRoFtKSSbwSoOwchf5XXcAHTTK/aivGp7F2cKPO9W97lQN4ZOLM3ZzajAmcg9VbiVQ+ pn+6mmjus9xhWKnaxYJVsGCfBzJwwBTmUnFtetGLbR2HugDIcUFnYguOiZ9aGqrcMcVJ kOxPHLm/4BmuvC1kTkqtdDZeByCajkI2ybzMY0UzxBtf8boqN3o0as8UcEOVzxHQ+/Ye t9nA== X-Gm-Message-State: APjAAAWYyTkkraVFYp9OeQB7kE5xXzmo3OY3PJlVIpgXIc7w6Eeb1x6a 25nhFXrc7OduggPcmocRGcRZZf+V0sGK2DAhIUrat/Iiha0RMUFE7hq4lyk5yRIeitaoM9GabtS fPHT9v4LbRto9PA== X-Received: by 2002:a5d:4ac7:: with SMTP id y7mr1746404wrs.271.1569321801644; Tue, 24 Sep 2019 03:43:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwVcHKmINzFVFEgxDEtSuhieMjRN6uJE1k5HFWRllWOcDR+VYhsDeWCLvPNsTQuM/oH3089sw== X-Received: by 2002:a5d:4ac7:: with SMTP id y7mr1746385wrs.271.1569321801460; Tue, 24 Sep 2019 03:43:21 -0700 (PDT) Received: from [192.168.1.115] (240.red-88-21-68.staticip.rima-tde.net. [88.21.68.240]) by smtp.gmail.com with ESMTPSA id o9sm2784308wrh.46.2019.09.24.03.43.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Sep 2019 03:43:20 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH 07/35] MdeModulePkg: fix cast in GetModuleInfoFromHandle() calls To: devel@edk2.groups.io, lersek@redhat.com Cc: Dandan Bi , Eric Dong , Hao A Wu , Jian J Wang , Liming Gao , Ray Ni References: <20190917194935.24322-1-lersek@redhat.com> <20190917194935.24322-8-lersek@redhat.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Openpgp: id=89C1E78F601EE86C867495CBA2A3FD6EDEADC0DE; url=http://pgp.mit.edu/pks/lookup?op=get&search=0xA2A3FD6EDEADC0DE Message-ID: Date: Tue, 24 Sep 2019 12:43:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190917194935.24322-8-lersek@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 > 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/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