[edk2-devel] [PATCH v2 1/2] MdeModulePkg/GraphicsConsoleDxe: Check status to make sure no error

Ni, Ray ray.ni at intel.com
Tue Mar 1 09:23:05 UTC 2022


Reviewed-by: Ray Ni <ray.ni at intel.com>

-----Original Message-----
From: Jiang, Guomin <guomin.jiang at intel.com> 
Sent: Tuesday, March 1, 2022 5:19 PM
To: devel at edk2.groups.io
Cc: Wang, Jian J <jian.j.wang at intel.com>; Gao, Liming <gaoliming at byosoft.com.cn>; Gao, Zhichao <zhichao.gao at intel.com>; Ni, Ray <ray.ni at intel.com>
Subject: [PATCH v2 1/2] MdeModulePkg/GraphicsConsoleDxe: Check status to make sure no error

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2668

SetMode will fail in some case. for example, without XServer.
Should handle these case when SetMode fail.

If we don't handle it, it will Segmentation fault.

Cc: Jian J Wang <jian.j.wang at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Cc: Zhichao Gao <zhichao.gao at intel.com>
Cc: Ray Ni <ray.ni at intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang at intel.com>
---
 .../Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
index 8f0cba9fcde9..07436cbd15bf 100644
--- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
+++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c
@@ -1,7 +1,7 @@
 /** @file
   This is the main routine for initializing the Graphics Console support routines.
 
-Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.<BR>
 SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -518,7 +518,7 @@ GraphicsConsoleControllerDriverStart (
       }
     }
 
-    if (ModeNumber != Private->GraphicsOutput->Mode->Mode) {
+    if (EFI_ERROR (Status) || (ModeNumber != Private->GraphicsOutput->Mode->Mode)) {
       //
       // Current graphics mode is not set or is not set to the mode which we have found,
       // set the new graphic mode.
-- 
2.35.1.windows.2



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