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 B78DE78003C for ; Tue, 26 Dec 2023 01:22:13 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=5wLh5JZUVGawRZgjKpxoCBlnzwrWtKeevBUNIYdCjsE=; 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=1703553732; v=1; b=nGhAVUHj1XZq5DGe+kYo7hUaNgKC0/YLxEwKKJ+I+osAIbiqcbvxQ6/0/6VhgDUpFOWoBIn/ Hd//Dv0z8CItu3rHhjwLZ+K6TEkAPLvO33dcPOCHOP2IL8Flj+0aQEprfS3vXY5b079FUnOoSIc rjZgqkRwFVAl3JU7UZFQMtKQ= X-Received: by 127.0.0.2 with SMTP id 3eQaYY7687511xUVI3h4HKt5; Mon, 25 Dec 2023 17:22:12 -0800 X-Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.53]) by mx.groups.io with SMTP id smtpd.web11.72872.1703553731830311795 for ; Mon, 25 Dec 2023 17:22:12 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wv2DrhssK1PCzKfLot5uXeoVWsHdqIRKJv1O7sIYk7x1ADtq8tPw1athrplMw82CR5lPxs/aLXfXav4cCpTrdrVeS/56/LHw+41dsM5DBI7G6UvYGxmfstUNnXhS00AgQQLd5SF2TCTrLm0BQ4nyeBztVTJDWoLGSs2XXhY22JB9DhTmIg5bTknu0N+8njWwbwl9EToO73PFEe1CxRIE9noUHGZdxHxapPnqnqvjRSS2DZIchRqzN3W+KC29jFb+7UqMJPhqB1XzNOrMOWLEl8pFSXNG4sV0hqOEvqJauEkWLBlVN5ZSyMwKNyDCbhfphipYNLR9cEfEGwtMXmfJrQ== 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=/SyMdwiOmsI+gcEIZW46g2bGbUCnP0KTd4IhhYHnUGI=; b=br2wRknd6QiTEJq15pw7BVv0eQHM0HciuSTl/ToblnuQ4yyTQbohpHPNdeM1N/JcX8s5AywACj183E2Qa3FvKZEznrht5oX0DpaWWnBl/Pi85mXIa9hA2y8G+OzutDRH5Y7pWNmdQWslEQzsQuUfiv27G2S2pbxMghb8/xvJUkF/9RbZXm+JFAKq8E/GVAJ+6IBGVDlsLhOWTLXS0joq9sSHq4JNkGrBKAbmWqvilpGPRyM7DFUu2rvDpHLqaeBOcpHsJjCqnQC/A8Vgj7zIH6QEQ0JVk5X9KeDmh1V6RCTG13IjkugV0hNpPGOC2M2DXBrZkJ76daNbDTUV2gSmQw== 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 DM4PR12MB6134.namprd12.prod.outlook.com (2603:10b6:8:ad::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.27; Tue, 26 Dec 2023 01:22:09 +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.7113.026; Tue, 26 Dec 2023 01:22:09 +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 v3 15/16] RedfishDiscoverDxe: handle memory allocation error conditions. Thread-Topic: [PATCH v3 15/16] RedfishDiscoverDxe: handle memory allocation error conditions. Thread-Index: AQHaNrzkha/BUpV6pEKnREzrbh/YPLC6xmbw Date: Tue, 26 Dec 2023 01:22:09 +0000 Message-ID: References: <20231224225927.9119-1-mike.maslenkin@gmail.com> <20231224225927.9119-16-mike.maslenkin@gmail.com> In-Reply-To: <20231224225927.9119-16-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=4a78edde-49aa-434a-a861-00f119b99b11;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-26T01:22:06Z;MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN2PR12MB3966:EE_|DM4PR12MB6134:EE_ x-ms-office365-filtering-correlation-id: d56b0153-dd1d-49df-d0ba-08dc05b114ec x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: wcdnER7rMT6h2qkSG/eT7ipzAIMtEB0Pu7fydS+bliruHvCoZ2MkEjXsGxwHzG2hrvnKKaU88/n4E5CPiWnUW9PaN3W9KQv0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oZuK0YCvinek9Sdy4hA/Z0zySY?= =?us-ascii?Q?Gte+OY69vVamKj6382bqrAs5Nt3OmsRVjwmLsHx57BLvZdCugUoLhFyb8lcy?= =?us-ascii?Q?/1i3KgoQ4j8CUU3ZK9ggA+hS8XggD9L3b9zsotp+rm/wVzs0UbkvwPnz64oj?= =?us-ascii?Q?Gwo9Nx8FbN+AKHq80SRE1bKMfy6W6UrBwuD6WCeShP6qp1mg8bK+G5kKlnKW?= =?us-ascii?Q?xt5i6svgLA+ip4Vmf7B0Oulq7HKMTZf3V0glo988TnxxZ6wC7rhjqreado/Q?= =?us-ascii?Q?VzvphFIPr7PY5Tazypq7cdnpXV4S5ZfZBeBnTtbSjy6o52BPfBOokt0PBzdO?= =?us-ascii?Q?xPjJold0ZSrW+2QUBhs=3D?= 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: d56b0153-dd1d-49df-d0ba-08dc05b114ec X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Dec 2023 01:22:09.7812 (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: BV1YSBBdMqq6SrbGeFYcKiqMSLHQxuzU6DHypv/1Ic2hAFAnqzYr+6y0c7/yxV8UhaV/AYDaXmVpqgA4c4ovQQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6134 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: dXMKXdmi6biW9OEjT2dTB9jXx7686176AA= 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=nGhAVUHj; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io [AMD Official Use Only - General] Reviewed-by: Abner Chang > -----Original Message----- > From: Mike Maslenkin > Sent: Monday, December 25, 2023 6:59 AM > To: devel@edk2.groups.io > Cc: Chang, Abner ; nicklew@nvidia.com; > igork@ami.com; Mike Maslenkin > Subject: [PATCH v3 15/16] RedfishDiscoverDxe: handle memory allocation > error conditions. > > Caution: This message originated from an External Source. Use proper caut= ion > when opening attachments, clicking links, or responding. > > > REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D4625 > > Cc: Abner Chang > Cc: Nickle Wang > Cc: Igor Kulchytskyy > Signed-off-by: Mike Maslenkin > --- > .../RedfishDiscoverDxe/RedfishDiscoverDxe.c | 89 ++++++++++++++++--- > 1 file changed, 78 insertions(+), 11 deletions(-) > > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > index bbd1f4b86400..1022ab090df8 100644 > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c > @@ -791,38 +791,105 @@ InitInformationData ( > if (RedfishLocation !=3D NULL) { > > 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 (Information->Location !=3D NULL) { > > + AsciiStrToUnicodeStrS (RedfishLocation, Information->Location, > AllocationSize); > > + DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n", > Information->Location)); > > + } else { > > + DEBUG (( > > + DEBUG_ERROR, > > + "%a: Can not allocate memory for Redfish service location: %a.\n= ", > > + __func__, > > + RedfishLocation > > + )); > > + } > > } > > > > if (Uuid !=3D NULL) { > > 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 (Information->Uuid !=3D NULL) { > > + AsciiStrToUnicodeStrS (Uuid, Information->Uuid, AllocationSize); > > + DEBUG ((DEBUG_MANAGEABILITY, "Service UUID: %s.\n", Information- > >Uuid)); > > + } else { > > + DEBUG (( > > + DEBUG_ERROR, > > + "%a: Can not allocate memory for Service UUID: %a.\n", > > + __func__, > > + Uuid > > + )); > > + } > > } > > > > if (Os !=3D NULL) { > > AllocationSize =3D AsciiStrSize (Os) * sizeof (CHAR16); > > Information->Os =3D AllocatePool (AllocationSize); > > - AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize); > > + if (Information->Os !=3D NULL) { > > + AsciiStrToUnicodeStrS (Os, Information->Os, AllocationSize); > > + } else { > > + DEBUG (( > > + DEBUG_ERROR, > > + "%a: Can not allocate memory for Redfish service OS: %a.\n", > > + __func__, > > + Os > > + )); > > + } > > } > > > > if (OsVer !=3D NULL) { > > 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 (Information->OsVersion !=3D NULL) { > > + AsciiStrToUnicodeStrS (OsVer, Information->OsVersion, AllocationSi= ze); > > + DEBUG (( > > + DEBUG_MANAGEABILITY, > > + "Redfish service OS: %s, Version:%s.\n", > > + Information->Os, > > + Information->OsVersion > > + )); > > + } else { > > + DEBUG (( > > + DEBUG_ERROR, > > + "%a: Can not allocate memory for Redfish OS Version:%a.\n", > > + __func__, > > + OsVer > > + )); > > + } > > } > > > > - if ((Product !=3D NULL) && (ProductVer !=3D NULL)) { > > + if (Product !=3D NULL) { > > AllocationSize =3D AsciiStrSize (Product) * sizeof (CHAR16); > > Information->Product =3D AllocatePool (AllocationSize); > > - AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSize= ); > > + if (Information->Product !=3D NULL) { > > + AsciiStrToUnicodeStrS (Product, Information->Product, AllocationSi= ze); > > + } else { > > + DEBUG (( > > + DEBUG_ERROR, > > + "%a: Can not allocate memory for Redfish service product: %a.\n"= , > > + __func__, > > + Product > > + )); > > + } > > + } > > + > > + if (ProductVer !=3D NULL) { > > 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)); > > + if (Information->ProductVer !=3D NULL) { > > + AsciiStrToUnicodeStrS (ProductVer, Information->ProductVer, > AllocationSize); > > + DEBUG (( > > + DEBUG_MANAGEABILITY, > > + "Redfish service product: %s, Version:%s.\n", > > + Information->Product, > > + Information->ProductVer > > + )); > > + } else { > > + DEBUG (( > > + DEBUG_ERROR, > > + "%a: Can not allocate memory for Redfish service product Version= : > %a.\n", > > + __func__, > > + 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 (#112896): https://edk2.groups.io/g/devel/message/112896 Mute This Topic: https://groups.io/mt/103354134/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-