public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Igor Kulchytskyy via groups.io" <igork=ami.com@groups.io>
To: Nickle Wang <nicklew@nvidia.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Abner Chang <abner.chang@amd.com>, Nick Ramirez <nramirez@nvidia.com>
Subject: Re: [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue.
Date: Mon, 24 Jul 2023 01:48:36 +0000	[thread overview]
Message-ID: <BLAPR10MB5185CE5DAE6548C0038F2E18A802A@BLAPR10MB5185.namprd10.prod.outlook.com> (raw)
In-Reply-To: <20230722081816.212-1-nicklew@nvidia.com>

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/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2023-07-24  1:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-22  8:18 [edk2-devel] [PATCH] RedfishPkg/RedfishPlatformConfigDxe: fix can not set one-of option issue Nickle Wang via groups.io
2023-07-24  1:48 ` Igor Kulchytskyy via groups.io [this message]
2023-08-03  6:00   ` Nickle Wang via groups.io
2023-08-03 13:27     ` Igor Kulchytskyy via groups.io
2023-09-12  7:04       ` Nickle Wang via groups.io

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BLAPR10MB5185CE5DAE6548C0038F2E18A802A@BLAPR10MB5185.namprd10.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox