[edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.

Nickle Wang via groups.io posted 1 patch 9 months, 1 week ago
Failed in applying to current master (apply log)
.../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c     | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
[edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.
Posted by Nickle Wang via groups.io 9 months, 1 week ago
StatementValue->Buffer is converted from ASCII to Unicode by caller
already so we don't have to convert it again.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
---
 .../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index f2a8e77d9b00..648f3d2de7aa 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -1660,7 +1660,11 @@ RedfishPlatformConfigSetStatementCommon (
     // in string format from HII point of view. Do a patch here.
     //
     if ((TargetStatement->HiiStatement->Operand == EFI_IFR_ONE_OF_OP) && (StatementValue->Type == EFI_IFR_TYPE_STRING)) {
-      TempBuffer = StrToUnicodeStr ((CHAR8 *)StatementValue->Buffer);
+      //
+      // Make a copy of input buffer to TempBuffer because StatementValue will be
+      // assigned in HiiStringToOneOfOptionValue().
+      //
+      TempBuffer = AllocateCopyPool (StrSize ((EFI_STRING)StatementValue->Buffer), StatementValue->Buffer);
       if (TempBuffer == NULL) {
         return EFI_OUT_OF_RESOURCES;
       }
-- 
2.17.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107140): https://edk2.groups.io/g/devel/message/107140
Mute This Topic: https://groups.io/mt/100292370/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.
Posted by Igor Kulchytskyy via groups.io 9 months, 1 week ago
Hi Nickle,
May I ask you a question. What is the point to allocate and copy buffer. Then delete the original buffer.
Could we just assign StatementValue->Buffer to TempBuffer and then assign NULL to StatementValue->Buffer?

TempBuffer = StatementValue->Buffer;
StatementValue->Buffer = NULL;

Result would be the same, but we do not need to allocate and free memory.
Or I do not understand something?
Thank you,
Igor

-----Original Message-----
From: Nickle Wang <nicklew@nvidia.com>
Sent: Saturday, July 22, 2023 4:18 AM
To: devel@edk2.groups.io
Cc: Abner Chang <abner.chang@amd.com>; Igor Kulchytskyy <igork@ami.com>; Nick Ramirez <nramirez@nvidia.com>
Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.


**CAUTION: The e-mail below is from an external source. Please exercise caution before opening attachments, clicking links, or following guidance.**

StatementValue->Buffer is converted from ASCII to Unicode by caller
already so we don't have to convert it again.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
---
 .../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c     | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
index f2a8e77d9b00..648f3d2de7aa 100644
--- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
+++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
@@ -1660,7 +1660,11 @@ RedfishPlatformConfigSetStatementCommon (
     // in string format from HII point of view. Do a patch here.
     //
     if ((TargetStatement->HiiStatement->Operand == EFI_IFR_ONE_OF_OP) && (StatementValue->Type == EFI_IFR_TYPE_STRING)) {
-      TempBuffer = StrToUnicodeStr ((CHAR8 *)StatementValue->Buffer);
+      //
+      // Make a copy of input buffer to TempBuffer because StatementValue will be
+      // assigned in HiiStringToOneOfOptionValue().
+      //
+      TempBuffer = AllocateCopyPool (StrSize ((EFI_STRING)StatementValue->Buffer), StatementValue->Buffer);
       if (TempBuffer == NULL) {
         return EFI_OUT_OF_RESOURCES;
       }
--
2.17.1

-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107150): https://edk2.groups.io/g/devel/message/107150
Mute This Topic: https://groups.io/mt/100292370/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.
Posted by Nickle Wang via groups.io 9 months ago
Hi Igor,

Thanks for your review. I think this is feasible. Let me try it and provide version 2 patch.

Thanks,
Nickle

> -----Original Message-----
> From: Igor Kulchytskyy <igork@ami.com>
> Sent: Monday, July 24, 2023 9:49 AM
> To: Nickle Wang <nicklew@nvidia.com>; devel@edk2.groups.io
> Cc: Abner Chang <abner.chang@amd.com>; Nick Ramirez
> <nramirez@nvidia.com>
> Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can
> not set one-of option issue.
> 
> External email: Use caution opening links or attachments
> 
> 
> Hi Nickle,
> May I ask you a question. What is the point to allocate and copy buffer. Then
> delete the original buffer.
> Could we just assign StatementValue->Buffer to TempBuffer and then assign
> NULL to StatementValue->Buffer?
> 
> TempBuffer = StatementValue->Buffer;
> StatementValue->Buffer = NULL;
> 
> Result would be the same, but we do not need to allocate and free memory.
> Or I do not understand something?
> Thank you,
> Igor
> 
> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Saturday, July 22, 2023 4:18 AM
> To: devel@edk2.groups.io
> Cc: Abner Chang <abner.chang@amd.com>; Igor Kulchytskyy <igork@ami.com>;
> Nick Ramirez <nramirez@nvidia.com>
> Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not
> set one-of option issue.
> 
> 
> **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
> 
> StatementValue->Buffer is converted from ASCII to Unicode by caller
> already so we don't have to convert it again.
> 
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
>  .../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c     | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> index f2a8e77d9b00..648f3d2de7aa 100644
> --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> @@ -1660,7 +1660,11 @@ RedfishPlatformConfigSetStatementCommon (
>      // in string format from HII point of view. Do a patch here.
>      //
>      if ((TargetStatement->HiiStatement->Operand == EFI_IFR_ONE_OF_OP) &&
> (StatementValue->Type == EFI_IFR_TYPE_STRING)) {
> -      TempBuffer = StrToUnicodeStr ((CHAR8 *)StatementValue->Buffer);
> +      //
> +      // Make a copy of input buffer to TempBuffer because StatementValue will be
> +      // assigned in HiiStringToOneOfOptionValue().
> +      //
> +      TempBuffer = AllocateCopyPool (StrSize ((EFI_STRING)StatementValue-
> >Buffer), StatementValue->Buffer);
>        if (TempBuffer == NULL) {
>          return EFI_OUT_OF_RESOURCES;
>        }
> --
> 2.17.1
> 
> -The information contained in this message may be confidential and proprietary
> to American Megatrends (AMI). This communication is intended to be read only by
> the individual or entity to whom it is addressed or by their designee. If the reader
> of this message is not the intended recipient, you are on notice that any
> distribution of this message, in any form, is strictly prohibited. Please promptly
> notify the sender by reply e-mail or by telephone at 770-246-8600, and then
> delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107516): https://edk2.groups.io/g/devel/message/107516
Mute This Topic: https://groups.io/mt/100292370/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.
Posted by Igor Kulchytskyy via groups.io 9 months ago
Thank you, Nickle.

-----Original Message-----
From: Nickle Wang <nicklew@nvidia.com>
Sent: Thursday, August 03, 2023 2:00 AM
To: Igor Kulchytskyy <igork@ami.com>; devel@edk2.groups.io
Cc: Abner Chang <abner.chang@amd.com>; Nick Ramirez <nramirez@nvidia.com>
Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.

Hi Igor,

Thanks for your review. I think this is feasible. Let me try it and provide version 2 patch.

Thanks,
Nickle

> -----Original Message-----
> From: Igor Kulchytskyy <igork@ami.com>
> Sent: Monday, July 24, 2023 9:49 AM
> To: Nickle Wang <nicklew@nvidia.com>; devel@edk2.groups.io
> Cc: Abner Chang <abner.chang@amd.com>; Nick Ramirez
> <nramirez@nvidia.com>
> Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can
> not set one-of option issue.
>
> External email: Use caution opening links or attachments
>
>
> Hi Nickle,
> May I ask you a question. What is the point to allocate and copy buffer. Then
> delete the original buffer.
> Could we just assign StatementValue->Buffer to TempBuffer and then assign
> NULL to StatementValue->Buffer?
>
> TempBuffer = StatementValue->Buffer;
> StatementValue->Buffer = NULL;
>
> Result would be the same, but we do not need to allocate and free memory.
> Or I do not understand something?
> Thank you,
> Igor
>
> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Saturday, July 22, 2023 4:18 AM
> To: devel@edk2.groups.io
> Cc: Abner Chang <abner.chang@amd.com>; Igor Kulchytskyy <igork@ami.com>;
> Nick Ramirez <nramirez@nvidia.com>
> Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not
> set one-of option issue.
>
>
> **CAUTION: The e-mail below is from an external source. Please exercise
> caution before opening attachments, clicking links, or following guidance.**
>
> StatementValue->Buffer is converted from ASCII to Unicode by caller
> already so we don't have to convert it again.
>
> Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> Cc: Abner Chang <abner.chang@amd.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Nick Ramirez <nramirez@nvidia.com>
> ---
>  .../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c     | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> index f2a8e77d9b00..648f3d2de7aa 100644
> --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> @@ -1660,7 +1660,11 @@ RedfishPlatformConfigSetStatementCommon (
>      // in string format from HII point of view. Do a patch here.
>      //
>      if ((TargetStatement->HiiStatement->Operand == EFI_IFR_ONE_OF_OP) &&
> (StatementValue->Type == EFI_IFR_TYPE_STRING)) {
> -      TempBuffer = StrToUnicodeStr ((CHAR8 *)StatementValue->Buffer);
> +      //
> +      // Make a copy of input buffer to TempBuffer because StatementValue will be
> +      // assigned in HiiStringToOneOfOptionValue().
> +      //
> +      TempBuffer = AllocateCopyPool (StrSize ((EFI_STRING)StatementValue-
> >Buffer), StatementValue->Buffer);
>        if (TempBuffer == NULL) {
>          return EFI_OUT_OF_RESOURCES;
>        }
> --
> 2.17.1
>
> -The information contained in this message may be confidential and proprietary
> to American Megatrends (AMI). This communication is intended to be read only by
> the individual or entity to whom it is addressed or by their designee. If the reader
> of this message is not the intended recipient, you are on notice that any
> distribution of this message, in any form, is strictly prohibited. Please promptly
> notify the sender by reply e-mail or by telephone at 770-246-8600, and then
> delete or destroy all copies of the transmission.
-The information contained in this message may be confidential and proprietary to American Megatrends (AMI). This communication is intended to be read only by the individual or entity to whom it is addressed or by their designee. If the reader of this message is not the intended recipient, you are on notice that any distribution of this message, in any form, is strictly prohibited. Please promptly notify the sender by reply e-mail or by telephone at 770-246-8600, and then delete or destroy all copies of the transmission.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107540): https://edk2.groups.io/g/devel/message/107540
Mute This Topic: https://groups.io/mt/100292370/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.
Posted by Nickle Wang via groups.io 7 months, 2 weeks ago
Hi Igor,

Version 2 is here: https://edk2.groups.io/g/devel/message/108516 Please help me to review this while you have chance.

Thanks,
Nickle

> -----Original Message-----
> From: Igor Kulchytskyy <igork@ami.com>
> Sent: Thursday, August 3, 2023 9:27 PM
> To: Nickle Wang <nicklew@nvidia.com>; devel@edk2.groups.io
> Cc: Abner Chang <abner.chang@amd.com>; Nick Ramirez
> <nramirez@nvidia.com>
> Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can
> not set one-of option issue.
> 
> External email: Use caution opening links or attachments
> 
> 
> Thank you, Nickle.
> 
> -----Original Message-----
> From: Nickle Wang <nicklew@nvidia.com>
> Sent: Thursday, August 03, 2023 2:00 AM
> To: Igor Kulchytskyy <igork@ami.com>; devel@edk2.groups.io
> Cc: Abner Chang <abner.chang@amd.com>; Nick Ramirez
> <nramirez@nvidia.com>
> Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can
> not set one-of option issue.
> 
> Hi Igor,
> 
> Thanks for your review. I think this is feasible. Let me try it and provide version 2
> patch.
> 
> Thanks,
> Nickle
> 
> > -----Original Message-----
> > From: Igor Kulchytskyy <igork@ami.com>
> > Sent: Monday, July 24, 2023 9:49 AM
> > To: Nickle Wang <nicklew@nvidia.com>; devel@edk2.groups.io
> > Cc: Abner Chang <abner.chang@amd.com>; Nick Ramirez
> > <nramirez@nvidia.com>
> > Subject: RE: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe:
> > fix can not set one-of option issue.
> >
> > External email: Use caution opening links or attachments
> >
> >
> > Hi Nickle,
> > May I ask you a question. What is the point to allocate and copy
> > buffer. Then delete the original buffer.
> > Could we just assign StatementValue->Buffer to TempBuffer and then
> > assign NULL to StatementValue->Buffer?
> >
> > TempBuffer = StatementValue->Buffer;
> > StatementValue->Buffer = NULL;
> >
> > Result would be the same, but we do not need to allocate and free memory.
> > Or I do not understand something?
> > Thank you,
> > Igor
> >
> > -----Original Message-----
> > From: Nickle Wang <nicklew@nvidia.com>
> > Sent: Saturday, July 22, 2023 4:18 AM
> > To: devel@edk2.groups.io
> > Cc: Abner Chang <abner.chang@amd.com>; Igor Kulchytskyy
> > <igork@ami.com>; Nick Ramirez <nramirez@nvidia.com>
> > Subject: [EXTERNAL] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix
> > can not set one-of option issue.
> >
> >
> > **CAUTION: The e-mail below is from an external source. Please
> > exercise caution before opening attachments, clicking links, or
> > following guidance.**
> >
> > StatementValue->Buffer is converted from ASCII to Unicode by caller
> > already so we don't have to convert it again.
> >
> > Signed-off-by: Nickle Wang <nicklew@nvidia.com>
> > Cc: Abner Chang <abner.chang@amd.com>
> > Cc: Igor Kulchytskyy <igork@ami.com>
> > Cc: Nick Ramirez <nramirez@nvidia.com>
> > ---
> >  .../RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c     | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git
> > a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> > b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> > index f2a8e77d9b00..648f3d2de7aa 100644
> > --- a/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> > +++ b/RedfishPkg/RedfishPlatformConfigDxe/RedfishPlatformConfigDxe.c
> > @@ -1660,7 +1660,11 @@ RedfishPlatformConfigSetStatementCommon (
> >      // in string format from HII point of view. Do a patch here.
> >      //
> >      if ((TargetStatement->HiiStatement->Operand == EFI_IFR_ONE_OF_OP)
> > && (StatementValue->Type == EFI_IFR_TYPE_STRING)) {
> > -      TempBuffer = StrToUnicodeStr ((CHAR8 *)StatementValue->Buffer);
> > +      //
> > +      // Make a copy of input buffer to TempBuffer because StatementValue will
> be
> > +      // assigned in HiiStringToOneOfOptionValue().
> > +      //
> > +      TempBuffer = AllocateCopyPool (StrSize
> > + ((EFI_STRING)StatementValue-
> > >Buffer), StatementValue->Buffer);
> >        if (TempBuffer == NULL) {
> >          return EFI_OUT_OF_RESOURCES;
> >        }
> > --
> > 2.17.1
> >
> > -The information contained in this message may be confidential and
> > proprietary to American Megatrends (AMI). This communication is
> > intended to be read only by the individual or entity to whom it is
> > addressed or by their designee. If the reader of this message is not
> > the intended recipient, you are on notice that any distribution of
> > this message, in any form, is strictly prohibited. Please promptly
> > notify the sender by reply e-mail or by telephone at 770-246-8600, and then
> delete or destroy all copies of the transmission.
> -The information contained in this message may be confidential and proprietary
> to American Megatrends (AMI). This communication is intended to be read only by
> the individual or entity to whom it is addressed or by their designee. If the reader
> of this message is not the intended recipient, you are on notice that any
> distribution of this message, in any form, is strictly prohibited. Please promptly
> notify the sender by reply e-mail or by telephone at 770-246-8600, and then
> delete or destroy all copies of the transmission.


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