From: "Samer El-Haj-Mahmoud" <samer.el-haj-mahmoud@arm.com>
To: devel@edk2.groups.io
Cc: Leif Lindholm <leif@nuviainc.com>, Pete Batard <pete@akeo.ie>,
Andrei Warkentin <awarkentin@vmware.com>,
Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 1/3] Platforms/RaspberryPi: Fix GOP parameter handling
Date: Tue, 21 Jul 2020 22:01:01 -0400 [thread overview]
Message-ID: <20200722020103.11808-2-Samer.El-Haj-Mahmoud@arm.com> (raw)
In-Reply-To: <20200722020103.11808-1-Samer.El-Haj-Mahmoud@arm.com>
Handle incorrect parameters passed to DisplayDxe GOP functions
QueryMode(), SetMode(), and Blt().
This fixes Blt_Conf and QueryMode_Conf failures
reported by SCT tests at:
https://github.com/pftf/RPi4/issues/73
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
---
Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c b/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c
index b880ca827bd6..80d0f7b2cb3c 100644
--- a/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c
+++ b/Platform/RaspberryPi/Drivers/DisplayDxe/DisplayDxe.c
@@ -1,5 +1,6 @@
/** @file
*
+ * Copyright (c) 2020, ARM Limited. All rights reserved.
* Copyright (c) 2017-2018, Andrei Warkentin <andrey.warkentin@gmail.com>
* Copyright (c) Microsoft Corporation. All rights reserved.
*
@@ -170,7 +171,7 @@ DisplayQueryMode (
EFI_STATUS Status;
GOP_MODE_DATA *Mode;
- if (ModeNumber > mLastMode) {
+ if (Info == NULL || SizeOfInfo == NULL || ModeNumber >= This->Mode->MaxMode) {
return EFI_INVALID_PARAMETER;
}
@@ -227,7 +228,7 @@ DisplaySetMode (
EFI_PHYSICAL_ADDRESS FbBase;
GOP_MODE_DATA *Mode = &mGopModeData[ModeNumber];
- if (ModeNumber > mLastMode) {
+ if (ModeNumber >= This->Mode->MaxMode) {
return EFI_UNSUPPORTED;
}
@@ -299,6 +300,14 @@ DisplayBlt (
UINT8 *VidBuf, *BltBuf, *VidBuf1;
UINTN i;
+ if ((UINTN)BltOperation >= EfiGraphicsOutputBltOperationMax) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if (Width == 0 || Height == 0) {
+ return EFI_INVALID_PARAMETER;
+ }
+
switch (BltOperation) {
case EfiBltVideoFill:
BltBuf = (UINT8*)BltBuffer;
@@ -349,7 +358,7 @@ DisplayBlt (
break;
default:
- ASSERT_EFI_ERROR (EFI_SUCCESS);
+ return EFI_INVALID_PARAMETER;
break;
}
--
2.17.1
next prev parent reply other threads:[~2020-07-22 2:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-22 2:01 [edk2-platform][PATCH v1 0/3] Platform/RaspberryPi : SCT EFI_GRAPHICS_OUTPUT_PROTOCOL fixes Samer El-Haj-Mahmoud
2020-07-22 2:01 ` Samer El-Haj-Mahmoud [this message]
2020-07-22 4:31 ` [edk2-platform][PATCH v1 1/3] Platforms/RaspberryPi: Fix GOP parameter handling Andrei Warkentin
2020-07-22 2:01 ` [edk2-platform][PATCH v1 2/3] Platforms/RaspberryPi: Return GOP PixelInformation in QueryMode() Samer El-Haj-Mahmoud
2020-07-22 4:31 ` Andrei Warkentin
2020-07-22 2:01 ` [edk2-platform][PATCH v1 3/3] Platforms/RaspberryPi: Fix GOP FrameBufferSize returned by SetMode() Samer El-Haj-Mahmoud
2020-07-22 4:32 ` Andrei Warkentin
2020-07-22 19:47 ` [edk2-platform][PATCH v1 0/3] Platform/RaspberryPi : SCT EFI_GRAPHICS_OUTPUT_PROTOCOL fixes Andrei Warkentin
2020-08-13 13:50 ` Ard Biesheuvel
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=20200722020103.11808-2-Samer.El-Haj-Mahmoud@arm.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