From nobody Fri Apr 26 03:28:38 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+80287+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+80287+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1630995181; cv=none; d=zohomail.com; s=zohoarc; b=F/BLC4Ti4Lxq1VNIYAY8YT57Tp73Ji6QovMmzCqGTLLqAGpSYYPQBAmu7VcRRNwjABfeRSgkii+kKDyDmxQGYIKcUAKCxe+8FlTCi+pSkRyxJDR/xZ/tpkbWuqJhQEnUZgbxCCIjVFB9nWmZkGiwgfZrCHqpwQNki1NLdnR+Ykw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630995181; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=yhJCDHpqr9i0DMSB1+YebMCzya7mB67hf2QNeEcX5LM=; b=dS6Q416Hka6T/pcwYbwEvi4UzZa+gduOZJsHtPIM86kDtPTi1zH2m9S4IMGhFqFP9QtyO/oFoSH4B9znaYrJlzRb78aDAG12Ohix4wvJ9bs/PXjj7lSItWt1GKjeQA39gKiTzuqFu/hdf+jqJLTz6S7uAuG6QAeFPKEf0C/i3/Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+80287+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1630995180918409.83447848008586; Mon, 6 Sep 2021 23:13:00 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id vzRUYY1788612xJzmEmXSTnp; Mon, 06 Sep 2021 23:13:00 -0700 X-Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web08.32191.1630995179288567971 for ; Mon, 06 Sep 2021 23:12:59 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10099"; a="207334236" X-IronPort-AV: E=Sophos;i="5.85,274,1624345200"; d="scan'208";a="207334236" X-Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2021 23:12:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,274,1624345200"; d="scan'208";a="502782949" X-Received: from gaozhic-desk.ccr.corp.intel.com ([10.239.137.133]) by fmsmga008.fm.intel.com with ESMTP; 06 Sep 2021 23:12:56 -0700 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Jian J Wang , Liming Gao , Ray Ni Subject: [edk2-devel] [PATCH] MdeModulePkg/UefiBootManagerLib: Limit the boot description to 72 chars Date: Tue, 7 Sep 2021 14:12:52 +0800 Message-Id: <20210907061252.2069-1-zhichao.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhichao.gao@intel.com X-Gm-Message-State: J8uvC3XtKe1nbAvMiKQEfrsWx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1630995180; bh=ybpRViswZ+TJ2m8n7NY0xfyNlR9W59+7yy3Pp4I/6/k=; h=Cc:Date:From:Reply-To:Subject:To; b=qQ11pPrxqAH1ZsGdRKq0yvcytnHB7zkgpvboxJClqnXdJu0ZbLTf5lVI+ngqbxsoINM Yw64V+hy3CsLS2Rk3m1x+xp4CSkJr2PsSrRHrrkjl2V6aWFR4PbjPAMaB/DkL363CL7vj JXFt3BGqvtOrqd+4k9447r+meUQfgyLSsB8= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1630995182247100002 Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3590 The minimum mode is 80*25 which means echo line can have 80 charactors and max 25 line on the screen. And the BootManagerMeu see each boot option as one line. The BootManagerMenuApp would have 2 charactors for draw box and 6 charactors for space. So it is better to limit the boot description within 72 charactors. Cc: Jian J Wang Cc: Liming Gao Cc: Ray Ni Signed-off-by: Zhichao Gao --- .../Library/UefiBootManagerLib/BmBootDescription.c | 24 ++++++++++++++++++= ---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c b/= MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c index aa891feb17..7260b2a203 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c @@ -1,7 +1,7 @@ /** @file Library functions which relate with boot option description. =20 -Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2011 - 2021, Intel Corporation. All rights reserved.
(C) Copyright 2015 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -14,6 +14,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define PRODUCT_IDENTIFICATION_OFFSET 11 #define PRODUCT_IDENTIFICATION_LENGTH 16 =20 +#define MAX_BOOT_DESCRIPTION_LEGNTH 72 + CONST UINT16 mBmUsbLangId =3D 0x0409; // English CHAR16 mBmUefiPrefix[] =3D L"UEFI "; =20 @@ -773,6 +775,7 @@ BmGetBootDescription ( CHAR16 *DefaultDescription; CHAR16 *Temp; UINTN Index; + UINTN DescriptionLen; =20 // // Firstly get the default boot description @@ -785,10 +788,23 @@ BmGetBootDescription ( // Avoid description confusion between UEFI & Legacy boot option by = adding "UEFI " prefix // ONLY for core provided boot description handler. // - Temp =3D AllocatePool (StrSize (DefaultDescription) + sizeof (mBmUef= iPrefix)); + if (StrLen (DefaultDescription) + StrLen (mBmUefiPrefix) > MAX_BOOT_= DESCRIPTION_LEGNTH) { + // + // Limit the MAX length of boot description to 72 charactors. + // Replace the last 3 charactors to L"...". + // + DescriptionLen =3D MAX_BOOT_DESCRIPTION_LEGNTH + 1; + DefaultDescription[MAX_BOOT_DESCRIPTION_LEGNTH - 5 - 3] =3D L'.'; + DefaultDescription[MAX_BOOT_DESCRIPTION_LEGNTH - 5 - 2] =3D L'.'; + DefaultDescription[MAX_BOOT_DESCRIPTION_LEGNTH - 5 - 1] =3D L'.'; + DefaultDescription[MAX_BOOT_DESCRIPTION_LEGNTH - 5] =3D L'\0'; + } else { + DescriptionLen =3D (StrSize (DefaultDescription) + sizeof (mBmUefi= Prefix)) / sizeof (CHAR16); + } + Temp =3D AllocatePool (DescriptionLen * sizeof (CHAR16)); ASSERT (Temp !=3D NULL); - StrCpyS (Temp, (StrSize (DefaultDescription) + sizeof (mBmUefiPrefix= )) / sizeof (CHAR16), mBmUefiPrefix); - StrCatS (Temp, (StrSize (DefaultDescription) + sizeof (mBmUefiPrefix= )) / sizeof (CHAR16), DefaultDescription); + StrCpyS (Temp, DescriptionLen, mBmUefiPrefix); + StrCatS (Temp, DescriptionLen, DefaultDescription); FreePool (DefaultDescription); DefaultDescription =3D Temp; break; --=20 2.16.2.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#80287): https://edk2.groups.io/g/devel/message/80287 Mute This Topic: https://groups.io/mt/85429661/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-