From nobody Mon Feb 9 09:53:05 2026 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+112561+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+112561+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1702596314; cv=none; d=zohomail.com; s=zohoarc; b=Apd5qAnsm1Vz0KEoIHjE2u0upqK3Lr1zBYCWIsHKYMUjCScgSka7BKNx88Y4tHo+o+2VINq/b0/mV7N0NwU8Kfzq+9u2QzIXY5oqddkGAJw2ualOeesyUlZjEsYuNH08AQyeTedrYeNe17Zsz3CA0TqB0WHgRIhFQs/p+bLjRdc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1702596314; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Sender:Subject:Subject:To:To:Message-Id; bh=djbXpXQw1oJOPWuQAtvAJ842/9VlPLrosN919g8q34I=; b=f5u1nezkQ7TMM9Q2HFjmgWjFlWQPNALAfKr/JbXIUFfevytnzcIRPYQqR3dxKoxbeECwQUxKp7pjNnRj/MC1A8m2XQ5M9HfWGde8rTy8b9cXMEj5uwBBYMzcKb+5nl8VvzsAJ1+9L7NEfT1W+uO57NRijSfwGAsPS9e+zfig+nU= 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+112561+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 1702596314089240.73612043982462; Thu, 14 Dec 2023 15:25:14 -0800 (PST) Return-Path: DKIM-Signature: a=rsa-sha256; bh=71cJ/EoVTt7+okRD0vwJglBE/DaYg31yN11qES5OKtI=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1702596313; v=1; b=AB0eWy/UXJETU6QDs+B3ZHgtG6lkW+1Rru+pHfIZ7rj6Vg3+XhPTD7UrpZRMjmqPNfLGDN5G le62d90q2R7aq7pWWEeqXv3Qm6C0iRqQtwIeZvRavWAnSdajdhNuoaDXrB8tl54IX5rMA5inCDs G6/qXiQRakW4COOcAXLXZ8DU= X-Received: by 127.0.0.2 with SMTP id NgaeYY1788612xvfp0EkC8HA; Thu, 14 Dec 2023 15:25:13 -0800 X-Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) by mx.groups.io with SMTP id smtpd.web11.44961.1702596312860362442 for ; Thu, 14 Dec 2023 15:25:13 -0800 X-Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2cb21afa6c1so877281fa.0 for ; Thu, 14 Dec 2023 15:25:12 -0800 (PST) X-Gm-Message-State: 4HZVCAONvFDb8wcc1or6mfdox1787277AA= X-Google-Smtp-Source: AGHT+IFiXonoHCeFCL7bvTq59QFlrYrrP5PMzX3Gf7+dLemYBb88/pIUaANqCdo6s0J5cPaZ072/Hw== X-Received: by 2002:a19:2d45:0:b0:50d:180a:b800 with SMTP id t5-20020a192d45000000b0050d180ab800mr4948449lft.10.1702596310989; Thu, 14 Dec 2023 15:25:10 -0800 (PST) X-Received: from localhost.localdomain ([79.164.221.98]) by smtp.gmail.com with ESMTPSA id j24-20020ac24558000000b0050bfe5815e7sm1973119lfm.165.2023.12.14.15.25.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 14 Dec 2023 15:25:10 -0800 (PST) From: "Mike Maslenkin" To: devel@edk2.groups.io Cc: abner.chang@amd.com, nicklew@nvidia.com, igork@ami.com, Mike Maslenkin Subject: [edk2-devel] [PATCH v2 12/14] RedfishDiscoverDxe: refine InitInformationData() function Date: Fri, 15 Dec 2023 02:24:56 +0300 Message-Id: <20231214232458.4636-13-mike.maslenkin@gmail.com> In-Reply-To: <20231214232458.4636-1-mike.maslenkin@gmail.com> References: <20231214232458.4636-1-mike.maslenkin@gmail.com> MIME-Version: 1.0 Precedence: Bulk 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,mike.maslenkin@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1702596316261100054 Content-Type: text/plain; charset="utf-8" Cache size of ASCII string in local variable. Cc: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy Signed-off-by: Mike Maslenkin Reviewed-by: Abner Chang --- .../RedfishDiscoverDxe/RedfishDiscoverDxe.c | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c b/RedfishPk= g/RedfishDiscoverDxe/RedfishDiscoverDxe.c index e3fc2d809dbc..3499a855570c 100644 --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c @@ -738,39 +738,47 @@ InitInformationData ( IN CONST CHAR8 *ProductVer OPTIONAL ) { + UINTN AllocationSize; + if (RedfishVersion !=3D NULL) { Information->RedfishVersion =3D *RedfishVersion; DEBUG ((DEBUG_MANAGEABILITY, "Redfish service version: %d.\n", Informa= tion->RedfishVersion)); } =20 if (RedfishLocation !=3D NULL) { - Information->Location =3D AllocatePool (AsciiStrSize (RedfishLocation)= * sizeof (CHAR16)); - AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, AsciiSt= rSize (RedfishLocation) * sizeof (CHAR16)); + AllocationSize =3D AsciiStrSize (RedfishLocation) * sizeof (CHA= R16); + Information->Location =3D AllocatePool (AllocationSize); + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, Allocat= ionSize); DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", Inform= ation->Location)); } =20 if (Uuid !=3D NULL) { - Information->Uuid =3D AllocatePool (AsciiStrSize (Uuid) * sizeof (CHAR= 16)); - AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AsciiStrSize (Uuid) * = sizeof (CHAR16)); + AllocationSize =3D AsciiStrSize (Uuid) * sizeof (CHAR16); + Information->Uuid =3D AllocatePool (AllocationSize); + AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize); DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information->Uuid)= ); } =20 if (Os !=3D NULL) { - Information->Os =3D AllocatePool (AsciiStrSize (Os) * sizeof (CHAR16)); - AsciiStrToUnicodeStrS (Os, Information->Os, AsciiStrSize (Os) * sizeof= (CHAR16)); - DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", = Information->Os, Information->OsVersion)); + AllocationSize =3D AsciiStrSize (Os) * sizeof (CHAR16); + Information->Os =3D AllocatePool (AllocationSize); + AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize); } =20 if (OsVer !=3D NULL) { - Information->OsVersion =3D AllocatePool (AsciiStrSize (OsVer) * sizeof= (CHAR16)); - AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AsciiStrSize (Os= Ver) * sizeof (CHAR16)); + AllocationSize =3D AsciiStrSize (OsVer) * sizeof (CHAR16); + Information->OsVersion =3D AllocatePool (AllocationSize); + AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSize); + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service OS: %s, Version:%s.\n", = Information->Os, Information->OsVersion)); } =20 if ((Product !=3D NULL) && (ProductVer !=3D NULL)) { - Information->Product =3D AllocatePool (AsciiStrSize (Product) * sizeof= (CHAR16)); - AsciiStrToUnicodeStrS (Product, Information->Product, AsciiStrSize (Pr= oduct) * sizeof (CHAR16)); - Information->ProductVer =3D AllocatePool (AsciiStrSize (ProductVer) * = sizeof (CHAR16)); - AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AsciiStrSi= ze (ProductVer) * sizeof (CHAR16)); + AllocationSize =3D AsciiStrSize (Product) * sizeof (CHAR16); + Information->Product =3D AllocatePool (AllocationSize); + AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize); + AllocationSize =3D AsciiStrSize (ProductVer) * sizeof (CHAR16= ); + Information->ProductVer =3D AllocatePool (AllocationSize); + AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, Allocation= Size); DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, Version:%s.= \n", Information->Product, Information->ProductVer)); } } --=20 2.32.0 (Apple Git-132) -=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 (#112561): https://edk2.groups.io/g/devel/message/112561 Mute This Topic: https://groups.io/mt/103181048/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-