public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ard Biesheuvel" <ardb@kernel.org>
To: edk2-devel-groups-io <devel@edk2.groups.io>,
	Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Jiewen Yao <jiewen.yao@intel.com>,
	 Jordan Justen <jordan.l.justen@intel.com>,
	Gerd Hoffmann <kraxel@redhat.com>,
	 Jeff Booher-Kaeding <Jeff.Booher-Kaeding@arm.com>,
	 Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>,
	Sunny Wang <Sunny.Wang@arm.com>,
	 Jeremy Linton <Jeremy.Linton@arm.com>
Subject: Re: [edk2-devel] [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode
Date: Wed, 27 Jul 2022 08:42:41 -0700	[thread overview]
Message-ID: <CAMj1kXHPJ2Ak1Z4j+_2dqtMLOsfqL3nGitOR0AWjfWH2MjwZqQ@mail.gmail.com> (raw)
In-Reply-To: <20220628184816.24493-1-Dimitrije.Pavlov@arm.com>

On Tue, 28 Jun 2022 at 11:48, Dimitrije Pavlov <Dimitrije.Pavlov@arm.com> wrote:
>
> Ensure that the PixelInformation field of the
> EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is zeroed out in
> EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode() and
> EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() when PixelFormat is
> PixelBlueGreenRedReserved8BitPerColor.
>
> According to UEFI 2.9 Section 12.9, PixelInformation field of the
> EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is valid only if
> PixelFormat is PixelBitMask. This means that firmware is not required
> to fill out the PixelInformation field for other PixelFormat types,
> which implies that the QemuVideoDxe implementation is technically
> correct.
>
> However, not zeroing out those fields will leak the contents of the
> memory returned by the memory allocator, so it is better to explicitly
> set them to zero.
>
> In addition, the SCT test suite relies on PixelInformation always
> having a consistent value, which causes failures.
>
> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Jordan Justen <jordan.l.justen@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Jeff Booher-Kaeding <Jeff.Booher-Kaeding@arm.com>
> Cc: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
> Cc: Sunny Wang <Sunny.Wang@arm.com>
> Cc: Jeremy Linton <Jeremy.Linton@arm.com>
>
> Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
> ---
>  OvmfPkg/QemuVideoDxe/Gop.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/OvmfPkg/QemuVideoDxe/Gop.c b/OvmfPkg/QemuVideoDxe/Gop.c
> index 0c4dea7fb6f2..7a9fe208c99c 100644
> --- a/OvmfPkg/QemuVideoDxe/Gop.c
> +++ b/OvmfPkg/QemuVideoDxe/Gop.c
> @@ -31,7 +31,14 @@ QemuVideoCompleteModeInfo (
>      Info->PixelInformation.ReservedMask  0;
>    } else if (ModeData->ColorDepth  32) {
>      DEBUG ((DEBUG_INFO, "PixelBlueGreenRedReserved8BitPerColor\n"));
> -    Info->PixelFormat  PixelBlueGreenRedReserved8BitPerColor;
> +    Info->PixelFormat                    PixelBlueGreenRedReserved8BitPerColor;
> +    Info->PixelInformation.RedMask       0;
> +    Info->PixelInformation.GreenMask     0;
> +    Info->PixelInformation.BlueMask      0;
> +    Info->PixelInformation.ReservedMask  0;

Is this valid C? Or is the patch corrupted by email?


> +  } else {
> +    DEBUG ((DEBUG_ERROR, "%a: Invalid ColorDepth %u", __FUNCTION__, ModeData->ColorDepth));
> +    ASSERT (FALSE);
>    }
>
>    Info->PixelsPerScanLine  Info->HorizontalResolution;
> --
> 2.34.1
>
>
>
> ------------
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#90822): https://edk2.groups.io/g/devel/message/90822
> Mute This Topic: https://groups.io/mt/92050521/1131722
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [ardb@kernel.org]
> ------------
>
>

  parent reply	other threads:[~2022-07-27 15:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 18:48 [PATCH v1 1/1] OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode Dimitrije Pavlov
2022-06-29  7:05 ` [edk2-devel] " Gerd Hoffmann
2022-07-14 14:28 ` Sunny Wang
2022-07-18 16:11 ` Samer El-Haj-Mahmoud
2022-07-27 15:42 ` Ard Biesheuvel [this message]
2022-07-27 19:34   ` [edk2-devel] " Dimitrije Pavlov
2022-07-27 20:39     ` Pedro Falcato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMj1kXHPJ2Ak1Z4j+_2dqtMLOsfqL3nGitOR0AWjfWH2MjwZqQ@mail.gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox