From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mx.groups.io with SMTP id smtpd.web12.21861.1628510155342186425 for ; Mon, 09 Aug 2021 04:55:55 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gfET2Noh; spf=pass (domain: kernel.org, ip: 198.145.29.99, mailfrom: ardb@kernel.org) Received: by mail.kernel.org (Postfix) with ESMTPSA id D20A661056 for ; Mon, 9 Aug 2021 11:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1628510153; bh=bGODPgFDBYvnGohjx76ha4aaFQCkHCFOd4qjyt48CCs=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=gfET2Noh5BYkzSHpgZyFhdB+qJ+/JHCx85tdX9vyYWXmMZe1eiJq5UTcFvKe6rA7V PokeEhBA73o1SyfW+qhCDNpIMLbw4L39I6AMN/2a/W8/GlCv9wtSXvE6GdcSMGEufC n3d+ON7i+xPIIw0Wk05+7KeBXczEy0jPebrbXDg/VnDO/9g5pZeoR5dEPTY1yg5Bn5 ptd0rFYLXyfh2LbASExGTqp4FBcNzpQ5HJ2j0o7cRQITrJfwwj3rBmrlVskjxmY7WH hqZ0Nj/+iDFmvHJLh8kHWYcS76xXj1qxDeS5bbt8A2J5BoldPw0CbjjTQtQXwM6bkg toifOeY3BzKhQ== Received: by mail-oi1-f171.google.com with SMTP id u10so23122906oiw.4 for ; Mon, 09 Aug 2021 04:55:53 -0700 (PDT) X-Gm-Message-State: AOAM531OWD+NOsO+m1ecIegGvohKUug3IUBxOqtwKOfTH9BQExzMFHiB /3Uh61hKrucSSyqhhiKiU4p9PMmtKnkvt0fKUYI= X-Google-Smtp-Source: ABdhPJwKKISfkA7j8FwYbSytlQcu1dU6aK7borOf4g5xUqyxBOwavRLyv2F1/q0bECtYeNDcBrHp7cb84vPUZfjYKfI= X-Received: by 2002:aca:dd89:: with SMTP id u131mr3043863oig.47.1628510153241; Mon, 09 Aug 2021 04:55:53 -0700 (PDT) MIME-Version: 1.0 References: <961f3436a2b52a67aa6c8cd45c75c76835a3a5d8.1628502345.git.mhaeuser@posteo.de> In-Reply-To: <961f3436a2b52a67aa6c8cd45c75c76835a3a5d8.1628502345.git.mhaeuser@posteo.de> From: "Ard Biesheuvel" Date: Mon, 9 Aug 2021 13:55:42 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 4/7] ArmPkg/DefaultExceptionHandlerLib: Check DebugImageInfoTable type safely To: =?UTF-8?Q?Marvin_H=C3=A4user?= Cc: edk2-devel-groups-io , Leif Lindholm , Ard Biesheuvel , Vitaly Cheptsov Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, 9 Aug 2021 at 11:51, Marvin H=C3=A4user 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 > Cc: Ard Biesheuvel > Cc: Vitaly Cheptsov > Signed-off-by: Marvin H=C3=A4user 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/DefaultExceptionHa= ndlerUefi.c b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHan= dlerUefi.c > index e9fea4038252..9befb6d4db9b 100644 > --- a/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUe= fi.c > +++ b/ArmPkg/Library/DefaultExceptionHandlerLib/DefaultExceptionHandlerUe= fi.c > @@ -51,8 +51,8 @@ GetImageName ( > > Address =3D (CHAR8 *)(UINTN)FaultAddress; > for (Entry =3D 0; Entry < DebugTableHeader->TableSize; Entry++, DebugT= able++) { > - if (DebugTable->NormalImage !=3D NULL) { > - if ((DebugTable->NormalImage->ImageInfoType =3D=3D EFI_DEBUG_IMAGE= _INFO_TYPE_NORMAL) && > + if (DebugTable->ImageInfoType !=3D NULL) { > + if ((*DebugTable->ImageInfoType =3D=3D EFI_DEBUG_IMAGE_INFO_TYPE_N= ORMAL) && > (DebugTable->NormalImage->LoadedImageProtocolInstance !=3D NUL= L)) { > if ((Address >=3D (CHAR8 *)DebugTable->NormalImage->LoadedImageP= rotocolInstance->ImageBase) && > (Address <=3D ((CHAR8 *)DebugTable->NormalImage->LoadedImage= ProtocolInstance->ImageBase + DebugTable->NormalImage->LoadedImageProtocolI= nstance->ImageSize))) { > -- > 2.31.1 >