[edk2-devel] [PATCH 15/35] MdeModulePkg/PiSmmCore: make type punning consistent

Dong, Eric eric.dong at intel.com
Wed Sep 18 02:38:30 UTC 2019


Reviewed-by: Eric Dong <eric.dong at intel.com>

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek at redhat.com]
> Sent: Wednesday, September 18, 2019 3:49 AM
> To: edk2-devel-groups-io <devel at edk2.groups.io>
> Cc: Dong, Eric <eric.dong at intel.com>; Wu, Hao A <hao.a.wu at intel.com>;
> Wang, Jian J <jian.j.wang at intel.com>; Ni, Ray <ray.ni at intel.com>
> Subject: [PATCH 15/35] MdeModulePkg/PiSmmCore: make type punning
> consistent
> 
> The SmiHandlerRegister() function explicitly casts "SmiHandler" (of type
> (SMI_HANDLER*)) to EFI_HANDLE, when outputting "DispatchHandle".
> 
> Apply the same cast in the counterpart function SmiHandlerUnRegister(),
> which compares multiple "SmiHandler"s against the input "DispatchHandle".
> 
> This is a semantic cleanup; there is no functional change.
> 
> Cc: Eric Dong <eric.dong at intel.com>
> Cc: Hao A Wu <hao.a.wu at intel.com>
> Cc: Jian J Wang <jian.j.wang at intel.com>
> Cc: Ray Ni <ray.ni at intel.com>
> Signed-off-by: Laszlo Ersek <lersek at redhat.com>
> ---
> 
> Notes:
>     build-tested only, most likely -- I'm unaware of any code paths in OVMF
>     that would lead to SmiHandlerUnRegister()
> 
>  MdeModulePkg/Core/PiSmmCore/Smi.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/PiSmmCore/Smi.c
> b/MdeModulePkg/Core/PiSmmCore/Smi.c
> index f8bd9f49ee3c..488af6754faf 100644
> --- a/MdeModulePkg/Core/PiSmmCore/Smi.c
> +++ b/MdeModulePkg/Core/PiSmmCore/Smi.c
> @@ -282,7 +282,7 @@ SmiHandlerUnRegister (
>    //
>    SmiHandler = NULL;
>    for ( HandlerLink = GetFirstNode (&mRootSmiEntry.SmiHandlers)
> -      ; !IsNull (&mRootSmiEntry.SmiHandlers, HandlerLink) && (SmiHandler !=
> DispatchHandle)
> +      ; !IsNull (&mRootSmiEntry.SmiHandlers, HandlerLink) &&
> + ((EFI_HANDLE) SmiHandler != DispatchHandle)
>        ; HandlerLink = GetNextNode (&mRootSmiEntry.SmiHandlers, HandlerLink)
>        ) {
>      SmiHandler = CR (HandlerLink, SMI_HANDLER, Link,
> SMI_HANDLER_SIGNATURE); @@ -292,19 +292,19 @@
> SmiHandlerUnRegister (
>    // Look for it in non-root SMI handlers
>    //
>    for ( EntryLink = GetFirstNode (&mSmiEntryList)
> -      ; !IsNull (&mSmiEntryList, EntryLink) && (SmiHandler != DispatchHandle)
> +      ; !IsNull (&mSmiEntryList, EntryLink) && ((EFI_HANDLE) SmiHandler
> + != DispatchHandle)
>        ; EntryLink = GetNextNode (&mSmiEntryList, EntryLink)
>        ) {
>      SmiEntry = CR (EntryLink, SMI_ENTRY, AllEntries, SMI_ENTRY_SIGNATURE);
>      for ( HandlerLink = GetFirstNode (&SmiEntry->SmiHandlers)
> -        ; !IsNull (&SmiEntry->SmiHandlers, HandlerLink) && (SmiHandler !=
> DispatchHandle)
> +        ; !IsNull (&SmiEntry->SmiHandlers, HandlerLink) &&
> + ((EFI_HANDLE) SmiHandler != DispatchHandle)
>          ; HandlerLink = GetNextNode (&SmiEntry->SmiHandlers, HandlerLink)
>          ) {
>        SmiHandler = CR (HandlerLink, SMI_HANDLER, Link,
> SMI_HANDLER_SIGNATURE);
>      }
>    }
> 
> -  if (SmiHandler != DispatchHandle) {
> +  if ((EFI_HANDLE) SmiHandler != DispatchHandle) {
>      return EFI_INVALID_PARAMETER;
>    }
> 
> --
> 2.19.1.3.g30247aa5d201
> 


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

View/Reply Online (#47442): https://edk2.groups.io/g/devel/message/47442
Mute This Topic: https://groups.io/mt/34180216/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list