From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mx.groups.io with SMTP id smtpd.web08.8618.1645501255304662045 for ; Mon, 21 Feb 2022 19:40:55 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=P8xEW24T; spf=pass (domain: intel.com, ip: 134.134.136.31, mailfrom: guomin.jiang@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645501255; x=1677037255; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tryXI8dI/h4L8Sw2nUXySQI0Na6mJWFa1zqTgFBRPQ8=; b=P8xEW24Tc2adnQxscdrNT/yEHzYMchJEdFstrzqcdMVOsLQuLcdi+EdQ DcPlzyUEwZPJQ8VBwpHtVhauKlTxuCOIVa1OvlfOc2zxPZLE7Cl+hk1M9 YtLRVNqqUNCqWAvHRw8otO2PxvDB9KUfFg4dkr1TRI/m5nhEaBSnx2sPB 8rqYArQku2yWeI6Gq9qsk5d8V1BuJGmLQmm+Ca+9LoDnWTtT4F7RFM9vC b6Api3vpEPHfdhjQyC56SEG9sg3NvqnUdqxT3Vj/jnUvA43/ttPhjdXYT BlELlfxEsT75LyKg5vIiTv8KXMYChljGyUDk7HzEwjMP5ZLjPlCMmmjVI g==; X-IronPort-AV: E=McAfee;i="6200,9189,10265"; a="312350669" X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="312350669" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2022 19:40:54 -0800 X-IronPort-AV: E=Sophos;i="5.88,387,1635231600"; d="scan'208";a="547554712" Received: from guominji-mobl1.ccr.corp.intel.com ([10.238.15.53]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2022 19:40:51 -0800 From: "Guomin Jiang" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Zhichao Gao , Ray Ni Subject: [PATCH 1/2] MdeModulePkg/GraphicsConsoleDxe: Check status to make sure no error Date: Tue, 22 Feb 2022 11:40:37 +0800 Message-Id: <20220222034038.966-2-guomin.jiang@intel.com> X-Mailer: git-send-email 2.35.1.windows.2 In-Reply-To: <20220222034038.966-1-guomin.jiang@intel.com> References: <20220222034038.966-1-guomin.jiang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Cc: Liming Gao Cc: Zhichao Gao Cc: Ray Ni Signed-off-by: Guomin Jiang --- .../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/GraphicsConsole.c index 1bdd1b8a6732..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.
+Copyright (c) 2006 - 2022, Intel Corporation. All rights reserved.
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