From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.151, mailfrom: dandan.bi@intel.com) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by groups.io with SMTP; Wed, 18 Sep 2019 18:46:50 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Sep 2019 18:46:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,522,1559545200"; d="scan'208";a="212062012" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by fmsmga004.fm.intel.com with ESMTP; 18 Sep 2019 18:46:48 -0700 Received: from shsmsx107.ccr.corp.intel.com (10.239.4.96) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 18 Sep 2019 18:46:49 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.32]) by SHSMSX107.ccr.corp.intel.com ([169.254.9.89]) with mapi id 14.03.0439.000; Thu, 19 Sep 2019 09:46:46 +0800 From: "Dandan Bi" To: Laszlo Ersek , edk2-devel-groups-io CC: "Dong, Eric" , "Wu, Hao A" , "Wang, Jian J" , "Gao, Liming" , "Ni, Ray" Subject: Re: [PATCH 07/35] MdeModulePkg: fix cast in GetModuleInfoFromHandle() calls Thread-Topic: [PATCH 07/35] MdeModulePkg: fix cast in GetModuleInfoFromHandle() calls Thread-Index: AQHVbZElOVx4+RNtx0W94FGpiS1BGKcyPP9g Date: Thu, 19 Sep 2019 01:46:45 +0000 Message-ID: <3C0D5C461C9E904E8F62152F6274C0BB40C5D9EB@SHSMSX104.ccr.corp.intel.com> References: <20190917194935.24322-1-lersek@redhat.com> <20190917194935.24322-8-lersek@redhat.com> In-Reply-To: <20190917194935.24322-8-lersek@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: dandan.bi@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Dandan Bi Thanks, Dandan > -----Original Message----- > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Wednesday, September 18, 2019 3:49 AM > To: edk2-devel-groups-io > Cc: Bi, Dandan ; Dong, Eric ; > Wu, Hao A ; Wang, Jian J ; > Gao, Liming ; Ni, Ray > Subject: [PATCH 07/35] MdeModulePkg: fix cast in > GetModuleInfoFromHandle() calls >=20 > 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 mas= ked. >=20 > Note that the *value* that is passed is alright -- therefore this patch d= oes not > change behavior --, it's just semantically wrong to pass an > (EFI_HANDLE*) where an EFI_HANDLE is expected. >=20 > 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 > --- >=20 > Notes: > lightly tested, as DxeCorePerformanceLib is linked into ArmVirtQemu's > DxeCore >=20 >=20 > MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c > | 12 ++++++------ > MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformanceLi > b.c | 8 ++++---- > 2 files changed, 10 insertions(+), 10 deletions(-) >=20 > diff --git > a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.c > b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.c > index 0d507c445210..f500e20b320b 100644 > --- > a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.c > +++ > b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLi > b.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 =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, > + sizeof (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, > + sizeof (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, > + sizeof (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, > + sizeof (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, > ModuleName, 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/SmmCorePerformance > Lib.c > b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformance > Lib.c > index 5f07464c4ec7..b4f22c14ae73 100644 > --- > a/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformance > Lib.c > +++ > b/MdeModulePkg/Library/SmmCorePerformanceLib/SmmCorePerformance > Lib.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 =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, > + sizeof (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, > + sizeof (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, > ModuleName, sizeof (ModuleName), &ModuleGuid); > + GetModuleInfoFromHandle ((EFI_HANDLE)CallerIdentifier, > + ModuleName, sizeof (ModuleName), &ModuleGuid); > if (String !=3D NULL) { > StringPtr =3D String; > } else { > -- > 2.19.1.3.g30247aa5d201 >=20