[edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

Xiaolu.Jiang posted 1 patch 2 years, 4 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/edk2 tags/patchew/20211129021303.2199-1-xiaolu.jiang@intel.com
BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
Posted by Xiaolu.Jiang 2 years, 4 months ago
Currently the PCD Value only support 13 Guid,When use more 13 pcd will cause the build tool fail,
Need calculate the required memory,then allocate it.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>

Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
---
 BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c b/BaseTools/Source/C/DevicePath/DevicePath.c
index c4d224ed61..ed19eb52f6 100644
--- a/BaseTools/Source/C/DevicePath/DevicePath.c
+++ b/BaseTools/Source/C/DevicePath/DevicePath.c
@@ -170,7 +170,7 @@ int main(int argc, CHAR8 *argv[])
     fprintf(stderr, "Invalid option value, Device Path can't be NULL");
     return STATUS_ERROR;
   }
-  Str16 = (CHAR16 *)malloc(1024);
+  Str16 = (CHAR16 *)malloc((strlen (Str) + 1) * sizeof (CHAR16));
   if (Str16 == NULL) {
     fprintf(stderr, "Resource, memory cannot be allocated");
     return STATUS_ERROR;
-- 
2.30.2.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#84123): https://edk2.groups.io/g/devel/message/84123
Mute This Topic: https://groups.io/mt/87369900/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


回复: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
Posted by gaoliming 2 years, 4 months ago
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Xiaolu.Jiang
> 发送时间: 2021年11月29日 10:13
> 收件人: devel@edk2.groups.io
> 抄送: Xiaolu.Jiang <xiaolu.jiang@intel.com>; Bob Feng
> <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei
> Chen <yuwei.chen@intel.com>
> 主题: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for
> support more PCD value.
> 
> Currently the PCD Value only support 13 Guid,When use more 13 pcd will
> cause the build tool fail,
> Need calculate the required memory,then allocate it.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> 
> Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
> ---
>  BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c
> b/BaseTools/Source/C/DevicePath/DevicePath.c
> index c4d224ed61..ed19eb52f6 100644
> --- a/BaseTools/Source/C/DevicePath/DevicePath.c
> +++ b/BaseTools/Source/C/DevicePath/DevicePath.c
> @@ -170,7 +170,7 @@ int main(int argc, CHAR8 *argv[])
>      fprintf(stderr, "Invalid option value, Device Path can't be NULL");
> 
>      return STATUS_ERROR;
> 
>    }
> 
> -  Str16 = (CHAR16 *)malloc(1024);
> 
> +  Str16 = (CHAR16 *)malloc((strlen (Str) + 1) * sizeof (CHAR16));
> 
>    if (Str16 == NULL) {
> 
>      fprintf(stderr, "Resource, memory cannot be allocated");
> 
>      return STATUS_ERROR;
> 
> --
> 2.30.2.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#84123): https://edk2.groups.io/g/devel/message/84123
> Mute This Topic: https://groups.io/mt/87369900/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#84124): https://edk2.groups.io/g/devel/message/84124
Mute This Topic: https://groups.io/mt/87372138/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.
Posted by Bob Feng 2 years, 4 months ago
Reviewed-by: Bob Feng <bob.c.feng@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of gaoliming
Sent: Monday, November 29, 2021 1:05 PM
To: devel@edk2.groups.io; Jiang, Xiaolu <xiaolu.jiang@intel.com>
Cc: Feng, Bob C <bob.c.feng@intel.com>; Chen, Christine <yuwei.chen@intel.com>
Subject: 回复: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for support more PCD value.

Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Xiaolu.Jiang
> 发送时间: 2021年11月29日 10:13
> 收件人: devel@edk2.groups.io
> 抄送: Xiaolu.Jiang <xiaolu.jiang@intel.com>; Bob Feng 
> <bob.c.feng@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Yuwei 
> Chen <yuwei.chen@intel.com>
> 主题: [edk2-devel][PATCH] BaseTools: Increase the DevicePath length for 
> support more PCD value.
> 
> Currently the PCD Value only support 13 Guid,When use more 13 pcd will 
> cause the build tool fail, Need calculate the required memory,then 
> allocate it.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3718
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> 
> Signed-off-by: Xiaolu Jiang <xiaolu.jiang@intel.com>
> ---
>  BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c
> b/BaseTools/Source/C/DevicePath/DevicePath.c
> index c4d224ed61..ed19eb52f6 100644
> --- a/BaseTools/Source/C/DevicePath/DevicePath.c
> +++ b/BaseTools/Source/C/DevicePath/DevicePath.c
> @@ -170,7 +170,7 @@ int main(int argc, CHAR8 *argv[])
>      fprintf(stderr, "Invalid option value, Device Path can't be 
> NULL");
> 
>      return STATUS_ERROR;
> 
>    }
> 
> -  Str16 = (CHAR16 *)malloc(1024);
> 
> +  Str16 = (CHAR16 *)malloc((strlen (Str) + 1) * sizeof (CHAR16));
> 
>    if (Str16 == NULL) {
> 
>      fprintf(stderr, "Resource, memory cannot be allocated");
> 
>      return STATUS_ERROR;
> 
> --
> 2.30.2.windows.1
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#84123): 
> https://edk2.groups.io/g/devel/message/84123
> Mute This Topic: https://groups.io/mt/87369900/4905953
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [gaoliming@byosoft.com.cn]
> -=-=-=-=-=-=
> 










-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#84534): https://edk2.groups.io/g/devel/message/84534
Mute This Topic: https://groups.io/mt/87602017/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-