From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 386A4D80A14 for ; Mon, 18 Dec 2023 04:32:06 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=nzX1mReGLvtXOjgYup02jPmUkxCJ1WMMH1RD6SCAKco=; c=relaxed/simple; d=groups.io; h=ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:msip_labels:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1702873924; v=1; b=tx6H2XTS1hlPy8NTd7XoP4P3C5WpLui/4oalG7gHS4MDW/qyStVb0k1uqgcph3xx/OELqyJJ xF4bHTpqA5eS0MsKXdgXQg8m4kVQkynDfAuKlL9bbVb0KO8AIaBSxs6XM+ugRJG1DJJTLGXsRW+ Lnjfw5EchMs6mUMiOVFppdVo= X-Received: by 127.0.0.2 with SMTP id zKatYY7687511xfQpWxa3fOZ; Sun, 17 Dec 2023 20:32:04 -0800 X-Received: from NAM04-DM6-obe.outbound.protection.outlook.com (NAM04-DM6-obe.outbound.protection.outlook.com [40.107.102.89]) by mx.groups.io with SMTP id smtpd.web11.35737.1702873924002634481 for ; Sun, 17 Dec 2023 20:32:04 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DkED9ROZi59YxbcxdYXqVl0qWiAWxKXGTQm89QOobfDoVNNoCC9OlYppa/FMGTZolB4VwnjOv4C5HnrKRuHOrMFWsRArqi2cSHZP/tp69ijK0hGwilYcLuqX4MKVWM3ItL6BKnvs6bdI3JOxWA+e9OWG0G/oBGVB3FTVbX7TEqvheDQtV5UfQfq3EWWcn1TnBgBjWMhQDQ3hDtFRBzgT+skh2U97djzUxALEMl7uMxowkmNTTPaVPi4B6/X6u9qPyzMW1fg+u2XzVma/asKg5kEkCL42EEKaN/DQeI8q1+58wbmyQy4lCBEjooy4c80R7a87GKXvMy0/2EhR7IPgsw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=kHrFKx9aUrntqcKGjIPnTziZ4AJviVgDtS3bS8tbyiM=; b=m+L3uJL2djc9cupUgzSH4kU1NARpYtBZMW6agu/Mo6B6gcvB4fpRwc5KZ5x0l4gE+7eJ1g7QIiS4URUillURM0kEQ1ZGBFtCVMGq8vWuMUHuk3suoLso1Wh0ETAZpqtkiP4GUU5tj6+OJMTboS/oFrvzLUs+6DrsvKEP62PessKWMJrwmWcCKua4R5GHPu+nTAMQKDSfb0IYGJ8PYQrJ6jeTyqfybY3aeNQBrJ70g6+v+FqLQn2j7qr5AFrXLYxkkB5P+IiVaBUd0CjzHvYI6HrD0wiiY1i3rQapvVeL7EHOoiNgrY7XfTch8VF04YSZPHqWie7BYcHoYyCjMTirVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none X-Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by SN7PR12MB7178.namprd12.prod.outlook.com (2603:10b6:806:2a6::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.37; Mon, 18 Dec 2023 04:32:00 +0000 X-Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::91d9:e679:32a3:dd05]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::91d9:e679:32a3:dd05%5]) with mapi id 15.20.7091.034; Mon, 18 Dec 2023 04:32:00 +0000 From: "Chang, Abner via groups.io" To: Mike Maslenkin , "devel@edk2.groups.io" CC: "nicklew@nvidia.com" , "igork@ami.com" Subject: Re: [edk2-devel] [PATCH v2 12/14] RedfishDiscoverDxe: refine InitInformationData() function Thread-Topic: [PATCH v2 12/14] RedfishDiscoverDxe: refine InitInformationData() function Thread-Index: AQHaLuTKkveL+i1Gj0WogDIMIy9aWLCud+LA Date: Mon, 18 Dec 2023 04:32:00 +0000 Message-ID: References: <20231214232458.4636-1-mike.maslenkin@gmail.com> <20231214232458.4636-13-mike.maslenkin@gmail.com> In-Reply-To: <20231214232458.4636-13-mike.maslenkin@gmail.com> Accept-Language: en-US, zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=87961a70-a10b-44f5-9afd-36a78079d468;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=0;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2023-12-18T04:29:48Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|SN7PR12MB7178:EE_ x-ms-office365-filtering-correlation-id: 27aac431-61b6-414b-7544-08dbff8246f1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: KQqlzrkY6fcy55K/GSV/LjBJNw8RM2UyvWPVrVmxDoMrUZCEQGnJde/F+X1f9/7DpCgAp/fTA+UBtOodNGhxFBQUaPhsJTO803fwligk1OpJlckmOo5/hBW7SnBfsoFkreZBVSUsCc88WrlwjwSXzcSy4pH49XAFN69LXjHvP7ai5bPgnlc66LN087eynHea+r2wnkrtFQJyvEbl9fiwYXfaztg/vmT407a5aD2diTKydYa4ZFvI3wgbZ4KkbQAHZGGE7hXT3YX7eFygNTw64lhE0/TZCxyrXvvdpLBbzIfy5EI//1mHDD0pZaPhWLwJXxkhDeSrGMFDamhhQ/Tj79oGz/YYOXRNJOqimPZyWIWhMcSFsz7DPDp4IWDsSuekzsshLLpdOkFpuA35B1/FHjDr3s5Pjth67Tl5s0vhwghofPHXx5hNfNIpk7YNbtMhhapQhf8lqJhhCvzZCdEVSpsf3cD4VvJTMu0uYxzSdk6cpcDof9P4VMBoKiwpqI75cPutK2xcu7/ewGq2Nv6Vd4onalEioCHd094CFhBZvPbDAMPPNUkjgABnG43rIcUL3y6GylQ3UF+3ZXN1dlJ/qYyI0aV4i16GDM/nVpd/WUdrxBMurwq5kFif3TMPxf5+33Sb6le6YxIxSrbm1YrxWS66LCznWgRm6yDFGaMmQrg= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QXssXFV1UgNt1OajL9KsD9YtYlnWIw6LbfKjvT2SZheyhXANfZJrAJc4eg+q?= =?us-ascii?Q?ouy2jQ1WikLjbFufJo0SbER855+YEFbMADIoK50hnrWd605qujzF1m5bn69H?= =?us-ascii?Q?LTUM2hrTW8KkqnWWCdL6EfLe7x30z8MAymvWYq+GcwvdcAOkA0KMbLno6G4l?= =?us-ascii?Q?3Ahrdf/mQElcvWR2tXKlYBzM33q1zvx9H8C5xo85t7j4eaF/WG5QMfL+frKL?= =?us-ascii?Q?mIq5hb1VT0Ur7q48w7fxOuXTlZM8tWCkXHoSOOSv5hlgTNF05YTfJwZ7MA8P?= =?us-ascii?Q?3Yk13c8tLK//5F0IUdtl4GhbyE/ayRFek2PJXYzlQ9YqD5z5PqBnrBCEBX/9?= =?us-ascii?Q?kSort2/Ba8Yv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n8?= =?us-ascii?Q?Onuwia/zHu68K/WQGlqIy9hz3LTdtuilQUlgsg4O8N6SxX00TLSYMCRWI2B9?= =?us-ascii?Q?62n/Kp8+SyGBkvY/HplDhnB9/9jwI4DJwmp7AgNCbnhID4/5oIfosGude2NV?= =?us-ascii?Q?brOtYL3tphzsXfW4PYL45xtV+qRc9rIr5KOKyYyClMCoHD0BWup9qyJ8GnVr?= =?us-ascii?Q?LjLwNKgeLWE4ZOkF4usnL5t1QyH7AHjgbEM7ycLopB2uC4ffP6kzbVurutUo?= =?us-ascii?Q?Sr58/xwDDBPFPHMDqHhOlDPsrAS35DG8FMEL25KoxorOqx1VQ36LLJdukfpn?= =?us-ascii?Q?hQroyw/2BtDLoVB7EtwqXyo2/3Dl8VsJkA0osChW?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 27aac431-61b6-414b-7544-08dbff8246f1 X-MS-Exchange-CrossTenant-originalarrivaltime: 18 Dec 2023 04:32:00.3822 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ljuMqngGPzMW8J91F/2VeGHO1+jOXqgG0T9rVD/MuZoTFyxa8KOvgBoqZmwBjrpCHACA06Y9VZ0udPLPPRBH9Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7178 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,abner.chang@amd.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: H9EsBWAxVmQqoziSJutG2ZiQx7686176AA= Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=tx6H2XTS; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=none; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}") [AMD Official Use Only - General] It's easy to read with this change. Reviewed-by: Abner Chang > -----Original Message----- > From: Mike Maslenkin > Sent: Friday, December 15, 2023 7:25 AM > To: devel@edk2.groups.io > Cc: Chang, Abner ; nicklew@nvidia.com; > igork@ami.com; Mike Maslenkin > Subject: [PATCH v2 12/14] RedfishDiscoverDxe: refine InitInformationData(= ) > function > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > Cache size of ASCII string in local variable. > > Cc: Abner Chang > Cc: Nickle Wang > Cc: Igor Kulchytskyy > Signed-off-by: Mike Maslenkin > --- > .../RedfishDiscoverDxe/RedfishDiscoverDxe.c | 34 ++++++++++++------- > 1 file changed, 21 insertions(+), 13 deletions(-) > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > b/RedfishPkg/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", > Information->RedfishVersion)); > > } > > > > if (RedfishLocation !=3D NULL) { > > - Information->Location =3D AllocatePool (AsciiStrSize (RedfishLocatio= n) * > sizeof (CHAR16)); > > - AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, Ascii= StrSize > (RedfishLocation) * sizeof (CHAR16)); > > + AllocationSize =3D AsciiStrSize (RedfishLocation) * sizeof (C= HAR16); > > + Information->Location =3D AllocatePool (AllocationSize); > > + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, > AllocationSize); > > DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", > Information->Location)); > > } > > > > if (Uuid !=3D NULL) { > > - Information->Uuid =3D AllocatePool (AsciiStrSize (Uuid) * sizeof (CH= AR16)); > > - 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)); > > } > > > > if (Os !=3D NULL) { > > - Information->Os =3D AllocatePool (AsciiStrSize (Os) * sizeof (CHAR16= )); > > - AsciiStrToUnicodeStrS (Os, Information->Os, AsciiStrSize (Os) * size= of > (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); > > } > > > > if (OsVer !=3D NULL) { > > - Information->OsVersion =3D AllocatePool (AsciiStrSize (OsVer) * size= of > (CHAR16)); > > - AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AsciiStrSize (= OsVer) > * 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)); > > } > > > > if ((Product !=3D NULL) && (ProductVer !=3D NULL)) { > > - Information->Product =3D AllocatePool (AsciiStrSize (Product) * size= of > (CHAR16)); > > - AsciiStrToUnicodeStrS (Product, Information->Product, AsciiStrSize > (Product) * sizeof (CHAR16)); > > - Information->ProductVer =3D AllocatePool (AsciiStrSize (ProductVer) = * sizeof > (CHAR16)); > > - AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, AsciiStr= Size > (ProductVer) * sizeof (CHAR16)); > > + AllocationSize =3D AsciiStrSize (Product) * sizeof (CHAR16); > > + Information->Product =3D AllocatePool (AllocationSize); > > + AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize= ); > > + AllocationSize =3D AsciiStrSize (ProductVer) * sizeof (CHAR= 16); > > + Information->ProductVer =3D AllocatePool (AllocationSize); > > + AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, > AllocationSize); > > DEBUG ((DEBUG_MANAGEABILITY, "Redfish service product: %s, > Version:%s.\n", Information->Product, Information->ProductVer)); > > } > > } > > -- > 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 (#112630): https://edk2.groups.io/g/devel/message/112630 Mute This Topic: https://groups.io/mt/103181048/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-