From nobody Sat Nov 2 12:23:27 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zoho.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org; Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1488393283904806.071574783141; Wed, 1 Mar 2017 10:34:43 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6522D821CF; Wed, 1 Mar 2017 10:34:42 -0800 (PST) Received: from mail-wr0-x231.google.com (mail-wr0-x231.google.com [IPv6:2a00:1450:400c:c0c::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 19940821B6 for ; Wed, 1 Mar 2017 10:34:41 -0800 (PST) Received: by mail-wr0-x231.google.com with SMTP id u48so36446704wrc.0 for ; Wed, 01 Mar 2017 10:34:41 -0800 (PST) Received: from localhost.localdomain ([105.147.1.203]) by smtp.gmail.com with ESMTPSA id 10sm7637694wrw.13.2017.03.01.10.34.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 01 Mar 2017 10:34:38 -0800 (PST) X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=K5iZPTtWkef16jajpj55UNXehMomc1gEvDz5AF2xwwg=; b=jBH/DjynSWV3iIa/b99lcevof+oe5lPHSsV7s5Lp6QRgct+ypAol+3ai+UxwTTeaI3 WCHqX1zdj96BanG7WpHBl8VFaBWqtxGVWTdx2JmMH3l5nznOig2cVWuMSb0wg7bYaMUr c1gaIHTt+oSsDdYI817OciQ91bzbnBNoncYJk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=K5iZPTtWkef16jajpj55UNXehMomc1gEvDz5AF2xwwg=; b=VvY0iTtVI8dSHTr/5pf9wwfTdPK/yYOd6vG/NogvHxtmFBv2KW0EsVYlQ37Lfv+O/K VC7Ds+S7qUesSGOHtgzfgfMypQB4FzvZGebm8H2BYO5SYGnqzGB/vUDipzLo58N0Dgib ScMeYdmWiNEoUe3ybXaTLad8702s56NHTEzT5juMUfm0R+FKLWx/bwuEXRMJb1Droteo Sm6NCB7aLyc/oGzE47TCXTQECcKHsBUoIxPvk3VuyhtWXXlJxetlF7EQSQMbFmrQMKVt fFvxL38NSN64odRS1FMeBmEjRHhwDYZqSnPZmAi9R81P4A77aMc6QhmQ2ewS83BM4hNK U5KQ== X-Gm-Message-State: AMke39m00KrW4SgAmOEwOVA9tyo95I25qPwVGfBNPxb8tp6TYsbSQIK09snyySKe4/gupVOw X-Received: by 10.223.132.37 with SMTP id 34mr8114333wrf.45.1488393279463; Wed, 01 Mar 2017 10:34:39 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, terry.lee@hpe.com Date: Wed, 1 Mar 2017 18:34:33 +0000 Message-Id: <1488393273-27283-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [edk2] [PATCH] ArmPlatformPkg/PlatformIntelBdsLib: don't clobber ConSplitter handle X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The InitializeConsolePipe() routine takes care to only set its output argument *Interface if it is not already set, to prevent overwriting the ConSplitter interface pointer that may have already been assigned. However, the associated OUT argument 'Handle' is clobbered by the subsequent unnecessary LocateDevicePath() invocation, which should similarly be made dependent on whether *Interface has been set already. Reported-by: "Lee, Terry Ping-Chung" Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel Reviewed-by: Leif Lindholm --- Terry: does this work for you? Thanks. ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c | 25 +++++++= +++---------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c = b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c index 885866854329..f8e04efea63d 100644 --- a/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c +++ b/ArmPlatformPkg/Library/PlatformIntelBdsLib/IntelBdsPlatform.c @@ -148,12 +148,19 @@ InitializeConsolePipe ( =20 Status =3D BdsLibConnectDevicePath (DevicePath); if (!EFI_ERROR (Status)) { - // - // If BdsLibConnectDevicePath () succeeded, *Handle must have a non-= NULL - // value. So ASSERT that this is the case. - // - gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, Han= dle); - ASSERT (*Handle !=3D NULL); + + // If the console splitter driver is not supported by the platform t= hen + // use the first Device Path instance for the console interface. + if (*Interface =3D=3D NULL) { + // + // If BdsLibConnectDevicePath () succeeded, *Handle must have a no= n-NULL + // value. So ASSERT that this is the case. + // + gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &DevicePath, H= andle); + ASSERT (*Handle !=3D NULL); + + gBS->HandleProtocol (*Handle, Protocol, Interface); + } } DEBUG_CODE_BEGIN(); if (EFI_ERROR(Status)) { @@ -172,12 +179,6 @@ InitializeConsolePipe ( } } DEBUG_CODE_END(); - - // If the console splitter driver is not supported by the platform the= n use the first Device Path - // instance for the console interface. - if (!EFI_ERROR(Status) && (*Interface =3D=3D NULL)) { - Status =3D gBS->HandleProtocol (*Handle, Protocol, Interface); - } } =20 // No Device Path has been defined for this console interface. We take t= he first protocol implementation --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel