Hi Liming, Jian, Zhichao, Ray, Can you help review it?
Thanks Guomin > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Guomin > Jiang > Sent: Tuesday, February 22, 2022 11:41 AM > 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: [edk2-devel] [PATCH 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> > --- > .../Console/GraphicsConsoleDxe/GraphicsConsole.c | 15 ++------------- > 1 file changed, 2 insertions(+), 13 deletions(-) > > diff --git > a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole > .c > b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsol > e.c > index 1bdd1b8a6732..07436cbd15bf 100644 > --- > a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole > .c > +++ > b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsol > e.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. > @@ -531,17 +531,6 @@ GraphicsConsoleControllerDriverStart ( > goto Error; > } > } > - > - // > - // Double confirm SetMode can success > - // > - Status = Private->GraphicsOutput->SetMode (Private->GraphicsOutput, > ModeNumber); > - if (EFI_ERROR (Status)) { > - // > - // The mode set operation failed > - // > - goto Error; > - } > } else if (FeaturePcdGet (PcdUgaConsumeSupport)) { > // > // At first try to set user-defined resolution > -- > 2.35.1.windows.2 > > > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#86939): https://edk2.groups.io/g/devel/message/86939 Mute This Topic: https://groups.io/mt/89355656/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-