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 9B597AC1004 for ; Mon, 4 Dec 2023 09:45:14 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ki8XqVYA6HxCZVFrBu0leQp9rLggP4+Y0BuhcHqTRHM=; 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: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=1701683113; v=1; b=rv5cHcnp/znT0iSj9Jg8wHMJOwvj3hJD/fxHS1gIDXxzW1nW71IfGiU2Cv18lf0MsuxSDvd5 StTppeEybjK+sBVWsEAFqwbwM4CnWEdH/Ia/DOqWi95UsrRY5dIsN5PDPIfo1CaAB8IQZMuloUf I3gDLPyv51PXOngZNEmnN66Q= X-Received: by 127.0.0.2 with SMTP id HyIuYY7687511xVcBX3OD55s; Mon, 04 Dec 2023 01:45:13 -0800 X-Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.107.94.74]) by mx.groups.io with SMTP id smtpd.web10.65955.1701683112606600368 for ; Mon, 04 Dec 2023 01:45:12 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WmTURVRzJbRE7EqfsYUeglTXUnxhmlqMKJEiHcio5O5MTFSgehenVY7uSBzVLr3rvHZ4nAzTb3zBC7tD2QcpTNmafltkoZxB0wPmm3r5CmIS0x6dzRIDAX77NfCz8tXVeYNaSc7aDDUxgQr1Jm1SfUimmAJPX1/ugB5dtVFXo/wW9nCKhbYkdbfEoFtgKPclW+679+d+1/i22P/SgiR++iFYiI7Bm1e9CXX6Z83mALVB42YOZiV87Mab/9qQQSeTr/s8Ff2I2IHqEuylUkLy4PbGpfT7BayXKjl5VXSpHbtc9WOHOrxPbOYCDe51DVMrhh1ipUjFX58ktsu9rqiNtg== 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=FCWBTsil7B1VGsJA+jOKY+P7Vz/Jdu51TtpzWH6s/Oo=; b=nGTWc7684AHMeI5jlfORnsBxigO+cdxTuhFsuOXgN+xB+xOORmt0GnrJU9ygTgQZ9PVUHqWmOFIQZ+IfoQegacL9x5/4zl7oN8imEL9ZrknyMeXjgsbaLvOnVEfiLAaTrQ9eQ8QxHukbBjJ5lDo7hxFtWrKjyLJoGg1UQX4S/XHB9CpJo2+ArBYjt4rRzYXFWKHPmp8BoiuMS7cbjjPsNZn8oRbx8mGvqCyNfHyQNF9gPU24LQ8rlvJV7TX0al4S9yVSeG1H6gy5VB7kdr6jVh8bcOHX4LrkdPGATUyHrkpVVEcFKUJ8/hTSEFKHx0dZmZE8qNZs15lGTf5NerCAew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none X-Received: from MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) by SA1PR12MB8144.namprd12.prod.outlook.com (2603:10b6:806:337::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7046.33; Mon, 4 Dec 2023 09:45:09 +0000 X-Received: from MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::a78e:602e:415c:4cb4]) by MW4PR12MB7031.namprd12.prod.outlook.com ([fe80::a78e:602e:415c:4cb4%3]) with mapi id 15.20.7046.033; Mon, 4 Dec 2023 09:45:08 +0000 From: "Nickle Wang via groups.io" To: Igor Kulchytskyy , "devel@edk2.groups.io" CC: Abner Chang , Nick Ramirez Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg/RedfishFeatureUtilityLib: validate string array Thread-Topic: [EXTERNAL] [edk2-redfish-client][PATCH] RedfishClientPkg/RedfishFeatureUtilityLib: validate string array Thread-Index: AQHaEhSpvi0zb+dV90OmOborwEIwN7ByAcpAgCcGBTA= Date: Mon, 4 Dec 2023 09:45:08 +0000 Message-ID: References: <20231108072433.90-1-nicklew@nvidia.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR12MB7031:EE_|SA1PR12MB8144:EE_ x-ms-office365-filtering-correlation-id: 01da8ea5-0d83-4ac5-eca5-08dbf4adb3ef x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: ZLUW0bGq4wMdE3/TYKX2ElJkEniPBsud0VwDYIKKbl6xKP/LU+OBB8h1u+fuX0Vyywt8IKP2bq6MsQyAK5TWe9eugM7Uk4dwwBRaBOaWii8FiZLM+V4FYyX8N+p8NIytVk+0k64j+DPdHtn4ZfVzziUWE2euuYvABYsnqyLjMb5lEahNRBX0ExONV1bk5Kv9AJUTLGSX9hbqfAdFCM/nzTWjBkcJeDsxdUChLmIAssSfD2StQs1nftv+1eyuDh+u5zYhAttMI+m7SnWWYmJxPlN35XZoBYru8bP0QYBTkAfM81I+YkYyByWY3bN7C9VYcYXcd1TEfwB8qoVctuErDoZn1/VWuWrGF2+RouD2NEeTACIZDLQ/ZdTwfoa+qOfd0UMemNJRqAE9QFgxz37047vXzcbMdTSgYqZkIvt+doKL3mlOUDkgdNuOmO/s7+PeQ88qtM64QHb+Cc04SJHFwtoYvW72zI7CnyHJixXhJ9AyD2hUm6d2etFpYkVZaTwwCDdiWG/ozEQ+UK8WE3Q5fhiwONONBT+OXfwu8HG7o0CD6aZWu51KQ7hMAfPlDmBcVGkeNMJAhkgb/GD9Z+NuShJXvd0yx66zZLQWomYW/ui92zxIXsIMXH043LP4LFF48K2bZQfkYlEULA5b8Nyy3Q== x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?E241UZymHi15iwSP1nz3nq4SE5YBrB/01tBSPb2mFDWM6syWG+OWLE9UadOJ?= =?us-ascii?Q?RZw9G3I7BR1RJnnBLlfUMnZ4W3VpQHy+psE1KrR7qB0sa+WNKsubUM98Yjgq?= =?us-ascii?Q?2Z3X0swdLs4OqYkLh8PG2HZA7Z+uSvvxpcu26MvhS+63qDacI3QB9denFLCW?= =?us-ascii?Q?XsebmPeehmLNpw5e2MfKSXhL2Q2f+qpQ/07v7bDTn+UUpjn8S7Wa3AR3SORb?= =?us-ascii?Q?cIx5dXw0lPUL24qMqNVPZS9wpBICKHMgvDMXOmuj36sdzXAznsaz5aOhEnDL?= =?us-ascii?Q?QJ7uFHMyKR0hjkTV4sdn2ib9py0hl6uABNMK0W8xqo8mOUO7YhyiEaRde5T/?= =?us-ascii?Q?cWT+KnOD0NdUABkWkNHfNCH1GwRN+T/vAJMsEHPBv1IFtkyDFdacuGU+Fy1v?= =?us-ascii?Q?ieghNWgZ/WkxK4xdErHX8N9t7HqOMc950Big7doXPKFyROaagcKmOeB7OHyd?= =?us-ascii?Q?48Sa5Dm0kkk/xwpmutR+ekzp1is/5qEFTNlgJZxJoEqAQOTJ9b2L8P/iBRBN?= =?us-ascii?Q?OIQ/OvlKwt0/J9OhjbvZ5EHSdGPTpbkA2OWTuPSMmk7aRRfJj9iEbiENB6ZM?= =?us-ascii?Q?+KS4pg/oqMJNPoQUXRfSS62t8uP8FWfyNcmoU8Y/XnJCCN0gj0WDd+kaWxd9?= =?us-ascii?Q?wUPSt1cgULshV5jnXyECvjo99WbExxuEyn5AxW6l0kMYb8+4rV7eVOMtD5CY?= =?us-ascii?Q?pDhD+YpkZeC20PHunTPluB3gWOsMIZLU8M3g2T1BD5dd59GvpZ8BX5eGjh7+?= =?us-ascii?Q?CnIq8RjJOppvszIKu8H2Yx+obtAX9jmV+0FS5vnw9D7XpCP2LPuCTKC0Qo+V?= =?us-ascii?Q?7JzpVRGpk1srDFohpz/GCAyo8hJm4N18MUYyb7qtHZvNDV7l6S5UFu2mRlRI?= =?us-ascii?Q?P9t49lo+aeBCyXTZ2AVv/gvvAp9HugPPJS+k/qxEqVds71gPWOP4JrIjsG+Y?= =?us-ascii?Q?YZdF/TUynBUdxaTd96MX3iMGzHn9sPGnjy/WE+0bHCtEs+6z772lLkNdRwV0?= =?us-ascii?Q?IJ9HwV4rsF8uREhZoAvhBP97YlHKnX0HjblzzCCzMEbkan/MIFt5lBRUSYCS?= =?us-ascii?Q?UaoOinSIxnZdkVvknd9G2x2508S2A2bVDbrX0/AYBxycsohsTeYfsZaYRGAl?= =?us-ascii?Q?l8bQsg7gIDp41XI8YgZ6F33gG2IhGmUCW/jmznNIQtouJYf524t5WX11YE9T?= =?us-ascii?Q?m/aWKv11htmByrq1OID+fvxLJU88444TqrGxo6He0sGmfszJc6hHZN8FdpR7?= =?us-ascii?Q?VfNNiCDTpiD1GcfHf+Y/h37y6ZRrlpUAsThFGkOKdtT7dtL4BVGETCJlLhPZ?= =?us-ascii?Q?WsNhTgedjyZTlFwYkRIIc3JSDIjfMkaOAjY8CIFcR1B6Fykkafi5j4MxlKcr?= =?us-ascii?Q?MtJbC8i/kQQCQDLqLhNy65ljyFerr9wbn1ETsVPf5pn0njcugfzU4ZhyO5eO?= =?us-ascii?Q?pmcSl/Wjl0Nd7VL37nI58b5/srcGatbRA5Q3ZWrsxoznqDMzNI1XENdUUtoZ?= =?us-ascii?Q?8d6RFyzZYgrvgqjiSfA0z36q6kyJNkEoiguBzgqLovAZdnO+FTMZRC5CGlJQ?= =?us-ascii?Q?HjQW2KLZp2zptFyWcLUORcdATnQyzVitCQnqrY+rD9fSYVx/qR1GVhhIAlS9?= =?us-ascii?Q?0F+MspjuVtHp/O3AlYIzH7Kize1INwLfqJ6K1LZTs9hm?= MIME-Version: 1.0 X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR12MB7031.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01da8ea5-0d83-4ac5-eca5-08dbf4adb3ef X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Dec 2023 09:45:08.8189 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ckG4gvGI6Y1xIDubZTEGMT88t76h9EJkQ7oTqS/mIG+TJsZ968BYWtULG06AQP4LyHAAR3qmIqhGeN4VkKxA+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8144 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,nicklew@nvidia.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: vGPSEGegVwoC3evqmq5LGBJix7686176AA= 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=rv5cHcnp; 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 Hi Igor, Sorry for my delay response. Having three checks in ValidateRedfishStringAr= rayValues is complicate to me so I took some time to verify it on my system= . > Maybe their functionality can be combined in ValidateRedfishStringArrayVa= lues? > Some additional an out parameter from that function can indicate If there= is no > change in array. This is good idea! I update ValidateRedfishStringArrayValues in version 2 p= atch file here: https://edk2.groups.io/g/devel/message/112025 PR: https://= github.com/tianocore/edk2-redfish-client/pull/58 Please help me to check th= em if you have time. Thanks, Nickle > -----Original Message----- > From: Igor Kulchytskyy > Sent: Thursday, November 9, 2023 11:11 PM > To: Nickle Wang ; devel@edk2.groups.io > Cc: Abner Chang ; Nick Ramirez > > Subject: RE: [EXTERNAL] [edk2-redfish-client][PATCH] > RedfishClientPkg/RedfishFeatureUtilityLib: validate string array >=20 > External email: Use caution opening links or attachments >=20 >=20 > Hi Nickle, > I noticed one typo. See below the text. >=20 > And I have a question regarding newly introduced > ValidateRedfishStringArrayValues function. > You use that function to check if value in Redfish string array can be fo= und in HII > configuration string array. > And you still call CompareRedfishStringArrayValues function. Both iterate= through > ArrayHead and RedfishValue.Value.StringArray. > Maybe their functionality can be combined in ValidateRedfishStringArrayVa= lues? > Some additional an out parameter from that function can indicate If there= is no > change in array. > What do you think? > Thank you, > Igor >=20 >=20 > -----Original Message----- > From: Nickle Wang > Sent: Wednesday, November 8, 2023 2:25 AM > To: devel@edk2.groups.io > Cc: Abner Chang ; Igor Kulchytskyy ; > Nick Ramirez > Subject: [EXTERNAL] [edk2-redfish-client][PATCH] > RedfishClientPkg/RedfishFeatureUtilityLib: validate string array >=20 >=20 > **CAUTION: The e-mail below is from an external source. Please exercise > caution before opening attachments, clicking links, or following guidance= .** >=20 > - Add function to validate Redfish request for string array type. There i= s case that > user request invalid string array and feature driver can not find corresp= onding HII > option. > - Fix typo. >=20 > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > Cc: Nick Ramirez > --- > .../Library/RedfishFeatureUtilityLib.h | 56 +++++-- > .../RedfishFeatureUtilityLib.c | 156 +++++++++++++----- > 2 files changed, 154 insertions(+), 58 deletions(-) >=20 > diff --git a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h > b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h > index e2f728b2..440c4b68 100644 > --- a/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h > +++ b/RedfishClientPkg/Include/Library/RedfishFeatureUtilityLib.h > @@ -22,7 +22,7 @@ >=20 > Read redfish resource by given resource URI. >=20 > - @param[in] Service Redfish srvice instacne to make query. > + @param[in] Service Redfish service instance to make query. > @param[in] ResourceUri Target resource URI. > @param[out] Response HTTP response from redfish service. >=20 > @@ -47,7 +47,7 @@ GetResourceByUri ( > @param[out] ArraySignatureClose String to the close of array sig= nature. >=20 > @retval EFI_SUCCESS Index is found. > - @retval EFI_NOT_FOUND The non-array configure language st= ring is > retured. > + @retval EFI_NOT_FOUND The non-array configure language st= ring is > returned. > @retval EFI_INVALID_PARAMETER The format of input ConfigureLang i= s > wrong. > @retval Others Errors occur. >=20 > @@ -118,10 +118,10 @@ GetNumberOfRedpathNodes ( >=20 > @param[in] NodeString The node string to parse. > @param[in] Index Index of the node. > - @param[out] EndOfNodePtr Pointer to receive the poitner to > + @param[out] EndOfNodePtr Pointer to receive the pointer to > the last character of node string. >=20 > - @retval EFI_STRING the begining of the node string. > + @retval EFI_STRING the beginning of the node string. >=20 > **/ > EFI_STRING > @@ -140,7 +140,7 @@ GetRedpathNodeByIndex ( > @param[out] Index The array index number. >=20 > @retval EFI_SUCCESS Index is found. > - @retval EFI_NOT_FOUND The non-array configure language st= ring is > retured. > + @retval EFI_NOT_FOUND The non-array configure language st= ring is > returned. > @retval EFI_INVALID_PARAMETER The format of input ConfigureLang i= s > wrong. > @retval Others Errors occur. >=20 > @@ -188,7 +188,7 @@ DestroyConfiglanguageList ( >=20 > @param[in] DestConfigLang Pointer to the node's configure lang= uage > string. > The memory pointed by ConfigLang mus= t be allocated > - through memory allocation interface.= Becasue we will > replace > + through memory allocation > + interface. Because we will replace > the pointer in this function. > @param[in] MaxtLengthConfigLang The maximum length of ConfigLang. > @param[in] ConfigLangInstance Pointer to Collection member instanc= e. > @@ -244,7 +244,7 @@ ApplyFeatureSettingsStringType ( >=20 > /** >=20 > - Apply property value to UEFI HII database in numric type. > + Apply property value to UEFI HII database in numeric type. >=20 > @param[in] Schema Property schema. > @param[in] Version Property schema version. > @@ -356,7 +356,7 @@ ApplyFeatureSettingsNumericArrayType ( > @param[in] Schema Property schema. > @param[in] Version Property schema version. > @param[in] ConfigureLang Configure language refers to this property. > - @param[in] ArrayHead Head of Redfich CS boolean array value. > + @param[in] ArrayHead Head of Redfish CS boolean array value. >=20 > @retval EFI_SUCCESS New value is applied successfully. > @retval Others Errors occur. > @@ -421,7 +421,7 @@ CreatePayloadToPatchResource ( > @param[in] ConfigLang ConfigLang to save > @param[in] Uri Redfish Uri to save >=20 > - @retval EFI_INVALID_PARAMETR SystemId is NULL or EMPTY > + @retval EFI_INVALID_PARAMETER SystemId is NULL or EMPTY > @retval EFI_SUCCESS Redfish uri is saved >=20 > **/ > @@ -433,7 +433,7 @@ RedfisSetRedfishUri ( >=20 > /** >=20 > - Get the property name by given Configure Langauge. > + Get the property name by given Configure Language. >=20 > @param[in] ResourceUri URI of root of resource. > @param[in] ConfigureLang Configure Language string. > @@ -576,7 +576,7 @@ GetOdataId ( >=20 > /** >=20 > - Return config language from given URI and prperty name. It's call resp= onsibility > to release returned buffer. > + Return config language from given URI and property name. It's call > responsibility to release returned buffer. >=20 > @param[in] Uri The URI to match > @param[in] PropertyName The property name of resource. This is optio= nal. > @@ -790,7 +790,7 @@ MatchPropertyWithJsonContext ( >=20 > /** >=20 > - Create string array and append to arry node in Redfish JSON convert fo= rmat. > + Create string array and append to array node in Redfish JSON convert f= ormat. >=20 > @param[in,out] Head The head of string array. > @param[in] StringArray Input string array. > @@ -809,7 +809,7 @@ AddRedfishCharArray ( >=20 > /** >=20 > - Create numeric array and append to arry node in Redfish JSON convert f= ormat. > + Create numeric array and append to array node in Redfish JSON convert > format. >=20 > @param[in,out] Head The head of string array. > @param[in] NumericArray Input numeric array. > @@ -828,7 +828,7 @@ AddRedfishNumericArray ( >=20 > /** >=20 > - Create boolean array and append to arry node in Redfish JSON convert f= ormat. > + Create boolean array and append to array node in Redfish JSON convert = format. >=20 > @param[in,out] Head The head of string array. > @param[in] BooleanArray Input boolean array. > @@ -866,12 +866,34 @@ CompareRedfishStringArrayValues ( > IN UINTN ArraySize > ); >=20 > +/** > + > + Check and see if value in Redfish string array can be found in HII > + configuration string array. This is to see if there is any invalid > + values from Redfish. > + > + @param[in] Head The head of string array. > + @param[in] StringArray Input string array. > + @param[in] ArraySize The size of StringArray. > + > + @retval TRUE All string in Redfish array are as same as s= tring >=20 > Igor: I think here we should have a plural of "string" > + @retval TRUE All strings in Redfish array are as same as = strings >=20 >=20 > + in HII configuration array. > + FALSE These two array are not identical. > + > +**/ > +BOOLEAN > +ValidateRedfishStringArrayValues ( > + IN RedfishCS_char_Array *Head, > + IN CHAR8 **StringArray, > + IN UINTN ArraySize > + ); > + > /** >=20 > Check and see if value in Redfish numeric array are all the same as th= e one > from HII configuration. >=20 > - @param[in] Head The head of Redfish CS numeraic array. > + @param[in] Head The head of Redfish CS numeric array. > @param[in] NumericArray Input numeric array. > @param[in] ArraySize The size of NumericArray. >=20 > @@ -914,9 +936,9 @@ CompareRedfishBooleanArrayValues ( > This is just a simple check. >=20 > @param[in] RedfishVagueKeyValuePtr The vague key value sets on Re= dfish > service. > - @param[in] RedfishVagueKeyValueNumber The numebr of vague key value > sets > + @param[in] RedfishVagueKeyValueNumber The number of vague key value > + sets > @param[in] ConfigVagueKeyValuePtr The vague configuration on pla= tform. > - @param[in] ConfigVagueKeyValueNumber The numebr of vague key value > sets > + @param[in] ConfigVagueKeyValueNumber The number of vague key value > sets >=20 > @retval TRUE All values are the same. > FALSE There is some difference. > diff --git > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtility= Lib.c > b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtility= Lib.c > index 13e29902..a3ca1006 100644 > --- > a/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUtility= Lib.c > +++ b/RedfishClientPkg/Library/RedfishFeatureUtilityLib/RedfishFeatureUt > +++ ilityLib.c > @@ -772,61 +772,69 @@ ApplyFeatureSettingsStringArrayType ( > } >=20 > // > - // If there is no change in array, do nothing > + // Check and see if element in request string array can be found in HI= I string > array. > // > - if (!CompareRedfishStringArrayValues (ArrayHead, > RedfishValue.Value.StringArray, RedfishValue.ArrayCount)) { > - // > - // Apply settings from redfish > - // > - DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s for array\n", > __func__, Schema, Version, ConfigureLang)); > - FreeArrayTypeRedfishValue (&RedfishValue); > - > + if (ValidateRedfishStringArrayValues (ArrayHead, > + RedfishValue.Value.StringArray, RedfishValue.ArrayCount)) { > // > - // Convert array from RedfishCS_char_Array to EDKII_REDFISH_VALUE > + // If there is no change in array, do nothing > // > - RedfishValue.ArrayCount =3D 0; > - Buffer =3D ArrayHead; > - while (Buffer !=3D NULL) { > - RedfishValue.ArrayCount +=3D 1; > - Buffer =3D Buffer->Next; > - } > + if (!CompareRedfishStringArrayValues (ArrayHead, > RedfishValue.Value.StringArray, RedfishValue.ArrayCount)) { > + // > + // Apply settings from redfish > + // > + DEBUG ((DEBUG_MANAGEABILITY, "%a: %a.%a apply %s for array\n", > __func__, Schema, Version, ConfigureLang)); > + FreeArrayTypeRedfishValue (&RedfishValue); >=20 > - // > - // Allocate pool for new values > - // > - RedfishValue.Value.StringArray =3D AllocatePool (RedfishValue.ArrayC= ount > *sizeof (CHAR8 *)); > - if (RedfishValue.Value.StringArray =3D=3D NULL) { > - ASSERT (FALSE); > - return EFI_OUT_OF_RESOURCES; > - } > + // > + // Convert array from RedfishCS_char_Array to EDKII_REDFISH_VALUE > + // > + RedfishValue.ArrayCount =3D 0; > + Buffer =3D ArrayHead; > + while (Buffer !=3D NULL) { > + RedfishValue.ArrayCount +=3D 1; > + Buffer =3D Buffer->Next; > + } >=20 > - Buffer =3D ArrayHead; > - Index =3D 0; > - while (Buffer !=3D NULL) { > - RedfishValue.Value.StringArray[Index] =3D AllocateCopyPool (AsciiS= trSize > (Buffer->ArrayValue), Buffer->ArrayValue); > - if (RedfishValue.Value.StringArray[Index] =3D=3D NULL) { > + // > + // Allocate pool for new values > + // > + RedfishValue.Value.StringArray =3D AllocatePool (RedfishValue.Arra= yCount > *sizeof (CHAR8 *)); > + if (RedfishValue.Value.StringArray =3D=3D NULL) { > ASSERT (FALSE); > - FreePool (RedfishValue.Value.StringArray); > return EFI_OUT_OF_RESOURCES; > } >=20 > - Buffer =3D Buffer->Next; > - Index++; > - } > + Buffer =3D ArrayHead; > + Index =3D 0; > + while (Buffer !=3D NULL) { > + RedfishValue.Value.StringArray[Index] =3D AllocateCopyPool (Asci= iStrSize > (Buffer->ArrayValue), Buffer->ArrayValue); > + if (RedfishValue.Value.StringArray[Index] =3D=3D NULL) { > + ASSERT (FALSE); > + FreePool (RedfishValue.Value.StringArray); > + return EFI_OUT_OF_RESOURCES; > + } >=20 > - ASSERT (Index <=3D RedfishValue.ArrayCount); > + Buffer =3D Buffer->Next; > + Index++; > + } >=20 > - Status =3D RedfishPlatformConfigSetValue (Schema, Version, Configure= Lang, > RedfishValue); > - if (!EFI_ERROR (Status)) { > - // > - // Configuration changed. Enable system reboot flag. > - // > - REDFISH_ENABLE_SYSTEM_REBOOT (); > + ASSERT (Index <=3D RedfishValue.ArrayCount); > + > + Status =3D RedfishPlatformConfigSetValue (Schema, Version, Configu= reLang, > RedfishValue); > + if (!EFI_ERROR (Status)) { > + // > + // Configuration changed. Enable system reboot flag. > + // > + REDFISH_ENABLE_SYSTEM_REBOOT (); > + } else { > + DEBUG ((DEBUG_ERROR, "%a: apply %s array failed: %r\n", __func__= , > ConfigureLang, Status)); > + } > } else { > - DEBUG ((DEBUG_ERROR, "%a: apply %s array failed: %r\n", __func__, > ConfigureLang, Status)); > + DEBUG ((DEBUG_ERROR, "%a: %a.%a %s array value has no change\n", > + __func__, Schema, Version, ConfigureLang)); > } > } else { > - DEBUG ((DEBUG_ERROR, "%a: %a.%a %s array value has no change\n", > __func__, Schema, Version, ConfigureLang)); > + DEBUG ((DEBUG_ERROR, "%a: %a.%a %s array value has invalid element, > skip!\n", __func__, Schema, Version, ConfigureLang)); > + Status =3D EFI_DEVICE_ERROR; > } >=20 > for (Index =3D 0; Index < RedfishValue.ArrayCount; Index++) { @@ -3432= ,6 > +3440,72 @@ CompareRedfishStringArrayValues ( > return TRUE; > } >=20 > +/** > + > + Check and see if value in Redfish string array can be found in HII > + configuration string array. This is to see if there is any invalid > + values from Redfish. > + > + @param[in] Head The head of string array. > + @param[in] StringArray Input string array. > + @param[in] ArraySize The size of StringArray. > + > + @retval TRUE All string in Redfish array are as same as s= tring > + in HII configuration array. > + FALSE These two array are not identical. > + > +**/ > +BOOLEAN > +ValidateRedfishStringArrayValues ( > + IN RedfishCS_char_Array *Head, > + IN CHAR8 **StringArray, > + IN UINTN ArraySize > + ) > +{ > + UINTN Index; > + UINTN InputArrayCount; > + RedfishCS_char_Array *CharArrayBuffer; > + > + if ((Head =3D=3D NULL) || (StringArray =3D=3D NULL) || (ArraySize =3D= =3D 0)) { > + return FALSE; > + } > + > + // > + // Check to see if string from Redfish can be found in string array > + // returned by HII or not. If not, the input from Redfish is invalid. > + // > + CharArrayBuffer =3D Head; > + Index =3D 0; > + InputArrayCount =3D 0; > + while (CharArrayBuffer !=3D NULL) { > + for (Index =3D 0; Index < ArraySize; Index++) { > + if (AsciiStrCmp (StringArray[Index], CharArrayBuffer->ArrayValue) = =3D=3D 0) { > + break; > + } > + } > + > + if (Index =3D=3D ArraySize) { > + DEBUG ((DEBUG_ERROR, "%a: input string: %a is not found in HII str= ing > list\n", __func__, CharArrayBuffer->ArrayValue)); > + return FALSE; > + } > + > + InputArrayCount +=3D 1; > + CharArrayBuffer =3D CharArrayBuffer->Next; } > + > + // > + // Check to see if the number of string from Redfish equals to the > + // number of string returned by HII. HII only accepts the same // > + number of string array due to the design or HII ordered list. > + // > + if (InputArrayCount !=3D ArraySize) { > + DEBUG ((DEBUG_ERROR, "%a: input string size: %d is not the same as H= II > string list size: %d\n", __func__, InputArrayCount, ArraySize)); > + return FALSE; > + } > + > + return TRUE; > +} > + > /** >=20 > Check and see if value in Redfish numeric array are all the same as th= e one > -- > 2.17.1 >=20 > -The information contained in this message may be confidential and propri= etary > to American Megatrends (AMI). This communication is intended to be read o= nly 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 th= en > delete or destroy all copies of the transmission. -=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 (#112026): https://edk2.groups.io/g/devel/message/112026 Mute This Topic: https://groups.io/mt/102459779/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-