Reviewed-by: Ray Ni <ray...@intel.com> -----Original Message----- From: Jiang, Guomin <guomin.ji...@intel.com> Sent: Tuesday, March 1, 2022 5:19 PM To: devel@edk2.groups.io Cc: Wang, Jian J <jian.j.w...@intel.com>; Gao, Liming <gaolim...@byosoft.com.cn>; Gao, Zhichao <zhichao....@intel.com>; Ni, Ray <ray...@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.w...@intel.com> Cc: Liming Gao <gaolim...@byosoft.com.cn> Cc: Zhichao Gao <zhichao....@intel.com> Cc: Ray Ni <ray...@intel.com> Signed-off-by: Guomin Jiang <guomin.ji...@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/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-