From nobody Sat Apr 27 00:14:43 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+83769+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+83769+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1637041935; cv=none; d=zohomail.com; s=zohoarc; b=DtzYP1oIcX3uSmFGNZOD6Q4KbaYcypt7sdqATNLNFRfZe0embfpmf9W4ZCnwYoZSpqJ8yllcTD0wHDj1Xlq2wXdsoBzkFvdKLmrAz+zOJzgOaPMqSWHAHY09Vw/iFN+b+X/8DC6DBS43Rw0hyTdHFgiBP4vQFnSHAZ0QN0Ga13o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637041935; 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=Sn2BufLcttIWuz+TV4bf73atiivCQBwJoQMwqo9H3bw=; b=D+zX8qRQzQAT7wzIF2XuGJaN74fyWOD2mhUzoq6nPZryUZ8BkQgUZaN08oI0+wqgglzsOGDRv9NBqOkykhAeicnKr7RGEfaerHNlJHLI6mFnD4tH1ASGRzaNqEitN0aNcwju5dFBZSBb3Bbz/oBPylHjGemegdzL8uuFg6ZQigE= 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+83769+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 163704193529151.10811169015119; Mon, 15 Nov 2021 21:52:15 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Ij79YY1788612xMiHn2ZUGTS; Mon, 15 Nov 2021 21:52:14 -0800 X-Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.4102.1637026945553992587 for ; Mon, 15 Nov 2021 17:42:25 -0800 X-IronPort-AV: E=McAfee;i="6200,9189,10169"; a="233540391" X-IronPort-AV: E=Sophos;i="5.87,237,1631602800"; d="scan'208";a="233540391" X-Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Nov 2021 17:42:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,237,1631602800"; d="scan'208";a="494260019" X-Received: from xiaolu-dev.ccr.corp.intel.com ([10.239.158.148]) by orsmga007.jf.intel.com with ESMTP; 15 Nov 2021 17:42:23 -0800 From: "Xiaolu.Jiang" To: devel@edk2.groups.io Cc: "Xiaolu.Jiang" , Bob Feng , Liming Gao , Yuwei Chen Subject: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value. Date: Tue, 16 Nov 2021 09:42:14 +0800 Message-Id: <20211116014214.745-1-xiaolu.jiang@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,Xiaolu.jiang@intel.com X-Gm-Message-State: 05bIyf1Y7zzGJd4nbyo16Lusx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1637041934; bh=jOM7wU1NCUUaeJWqi8aAcvij1lG26AgMLaqRHvzywp0=; h=Cc:Date:From:Reply-To:Subject:To; b=nn0wuerfP3ClBuzRcCPsftcT58urSrsOHiSHKXNwnpwJ3nRrOe0uEklQlyzDoazIEgi 21/KoIIgWn39eo292WmR9oOc1m9epyeucKm+tPxoUd0AjAOFQ4XXXQ05wdJAdZQQJdjWy QniwfZC9G9v06/Yp0cgcdxmABaERY5gkrZw= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1637041936483100001 Content-Type: text/plain; charset="utf-8" Currently the PCD Value only support 13 Guid,When use more 13 pcd will caus= e the build tool fail, Need calculate the required memory,then allocate it. REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3718 Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Signed-off-by: Xiaolu Jiang Reviewed-by: Bob Feng --- BaseTools/Source/C/DevicePath/DevicePath.c | 36 +++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c b/BaseTools/Source/= C/DevicePath/DevicePath.c index c4d224ed61..8a0f5f4e2a 100644 --- a/BaseTools/Source/C/DevicePath/DevicePath.c +++ b/BaseTools/Source/C/DevicePath/DevicePath.c @@ -144,6 +144,40 @@ Returns: *UniString =3D '\0'; } =20 + +/** + Returns the length of a Null-terminated ASCII string. + + This function returns the number of ASCII characters in the Null-termina= ted + ASCII string specified by String. + + If Length > 0 and Destination is NULL, then ASSERT(). + If Length > 0 and Source is NULL, then ASSERT(). + If PcdMaximumAsciiStringLength is not zero and String contains more than + PcdMaximumAsciiStringLength ASCII characters, not including the Null-ter= minator, + then ASSERT(). + + @param String A pointer to a Null-terminated ASCII string. + + @return The length of String. + +**/ +UINTN +EFIAPI +AsciiStrLen ( + IN CONST CHAR8 *String + ) +{ + UINTN Length; + + ASSERT (String !=3D NULL); + + for (Length =3D 0; *String !=3D '\0'; String++, Length++) { + + } + return Length; +} + int main(int argc, CHAR8 *argv[]) { CHAR8 * Str; @@ -170,7 +204,7 @@ int main(int argc, CHAR8 *argv[]) fprintf(stderr, "Invalid option value, Device Path can't be NULL"); return STATUS_ERROR; } - Str16 =3D (CHAR16 *)malloc(1024); + Str16 =3D (CHAR16 *)malloc((AsciiStrLen (Str) + 1) * sizeof (CHAR16)); if (Str16 =3D=3D NULL) { fprintf(stderr, "Resource, memory cannot be allocated"); return STATUS_ERROR; --=20 2.30.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 (#83769): https://edk2.groups.io/g/devel/message/83769 Mute This Topic: https://groups.io/mt/87089392/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-