[edk2-devel] [PATCH v2 4/7] ArmPkg/DefaultExceptionHandlerLib: Check DebugImageInfoTable type safely

Ard Biesheuvel ardb at kernel.org
Mon Aug 9 11:55:42 UTC 2021


On Mon, 9 Aug 2021 at 11:51, Marvin Häuser <mhaeuser at posteo.de> wrote:
>
> C does not allow casting to or dereferencing incompatible pointer
> types. Use the ImageInfoType member of the union first to determine
> the data type before dereferencing NormalImage.
>
> Cc: Leif Lindholm <leif at nuviainc.com>
> Cc: Ard Biesheuvel <ardb+tianocore at kernel.org>
> Cc: Vitaly Cheptsov <vit9696 at protonmail.com>
> Signed-off-by: Marvin Häuser <mhaeuser at posteo.de>

Hi Marvin,

Could you please organize your patches into a consistent series,
include a cover letter and cc me on everything?

I am going to disregard anything you sent yesterday and today, as it
is a bit of a jumble.

Thanks,
Ard.


> ---
>  ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
> index e9fea4038252..9befb6d4db9b 100644
> --- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
> +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUefi.c
> @@ -51,8 +51,8 @@ GetImageName (
>
>    Address = (CHAR8 *)(UINTN)FaultAddress;
>    for (Entry = 0; Entry < DebugTableHeader->TableSize; Entry++, DebugTable++) {
> -    if (DebugTable->NormalImage != NULL) {
> -      if ((DebugTable->NormalImage->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) &&
> +    if (DebugTable->ImageInfoType != NULL) {
> +      if ((*DebugTable->ImageInfoType == EFI_DEBUG_IMAGE_INFO_TYPE_NORMAL) &&
>            (DebugTable->NormalImage->LoadedImageProtocolInstance != NULL)) {
>          if ((Address >= (CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase) &&
>              (Address <= ((CHAR8 *)DebugTable->NormalImage->LoadedImageProtocolInstance->ImageBase + DebugTable->NormalImage->LoadedImageProtocolInstance->ImageSize))) {
> --
> 2.31.1
>


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#78954): https://edk2.groups.io/g/devel/message/78954
Mute This Topic: https://groups.io/mt/84764906/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