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 904D0941CEA for ; Wed, 21 Feb 2024 19:46:54 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=WKHkNUXOdW1OzkKkiB1FEKZ2xFKGlFBGYAv2yivGF3g=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20140610; t=1708544813; v=1; b=f3fAugz9cgyxxnhHNKC9LLS1WNF2ED7MRP1yFzBQR7EtfrxiQpvT2qI2BRk8MqHXivpOkiuV Ck8W+fo8/KJT71vyHZlc2YVACGg1UE6a9Wr405AexMrDGYV0RnlBJnxL6K7ipEvhDOziJugeh6g gA8jw/J5aRqWNL61SDh4bf6Y= X-Received: by 127.0.0.2 with SMTP id jvOyYY7687511xhuq6zOGNxm; Wed, 21 Feb 2024 11:46:53 -0800 X-Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by mx.groups.io with SMTP id smtpd.web10.602.1708544812619317365 for ; Wed, 21 Feb 2024 11:46:52 -0800 X-Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-6083dc087b3so36185237b3.0 for ; Wed, 21 Feb 2024 11:46:52 -0800 (PST) X-Gm-Message-State: j6putphdGDbiFrMB9CNaPu7ux7686176AA= X-Google-Smtp-Source: AGHT+IG2cZ7MSf0/ULpc8YZgLndzvVnyIx3nmSRnM5b39l4BiRKSx8g93iR1pF+jv0cseREXRuw+40IiWKgImytgXAQ= X-Received: by 2002:a05:690c:d84:b0:608:2186:3b79 with SMTP id da4-20020a05690c0d8400b0060821863b79mr13055950ywb.16.1708544811726; Wed, 21 Feb 2024 11:46:51 -0800 (PST) MIME-Version: 1.0 References: <20240221001303.57384-1-mike.maslenkin@gmail.com> <20240221001303.57384-3-mike.maslenkin@gmail.com> In-Reply-To: From: "Mike Maslenkin" Date: Wed, 21 Feb 2024 22:46:15 +0300 Message-ID: Subject: Re: [edk2-devel] [PATCH 2/4] RedfishClientPkg: refine RedfishExternalResourceResourceFeatureCallback To: "Chang, Abner" Cc: "devel@edk2.groups.io" , Nickle Wang , Igor Kulchytskyy 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-Type: text/plain; charset="UTF-8" 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=f3fAugz9; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=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 On Wed, Feb 21, 2024 at 5:34=E2=80=AFAM Chang, Abner = wrote: > > [AMD Official Use Only - General] > > > -----Original Message----- > > From: Mike Maslenkin > > Sent: Wednesday, February 21, 2024 8:13 AM > > To: devel@edk2.groups.io > > Cc: Mike Maslenkin ; Nickle Wang > > ; Chang, Abner ; Igor > > Kulchytskyy > > Subject: [PATCH 2/4] RedfishClientPkg: refine > > RedfishExternalResourceResourceFeatureCallback > > > > Caution: This message originated from an External Source. Use proper ca= ution > > when opening attachments, clicking links, or responding. > > > > > > Use local variable for CollectionUri passed to HandleResource() to avoi= d > > problems in case of Private->Uri is overriden down the call stack. > > > > Suggested-by: Nickle Wang > > Cc: Abner Chang > > Cc: Nickle Wang > > Cc: Igor Kulchytskyy > > Signed-off-by: Mike Maslenkin > > --- > > RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c | 11 ++++++----- > > 1 file changed, 6 insertions(+), 5 deletions(-) > > > > diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c > > b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c > > index f40f2d85af80..396ec22969b5 100644 > > --- a/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c > > +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Dxe/BiosDxe.c > > @@ -670,6 +670,7 @@ RedfishExternalResourceResourceFeatureCallback ( > > REDFISH_SERVICE RedfishService; > > > > REDFISH_RESOURCE_COMMON_PRIVATE *Private; > > > > EFI_STRING ResourceUri; > > > > + EFI_STRING CollectionUri; > > > > > > > > if (FeatureAction !=3D CallbackActionStartOperation) { > > > > return EFI_UNSUPPORTED; > > > > @@ -707,19 +708,19 @@ RedfishExternalResourceResourceFeatureCallback > > ( > > // > > > > // Initialize collection path > > > > // > > > > - Private->Uri =3D RedfishGetUri (ResourceUri); > > > > - if (Private->Uri =3D=3D NULL) { > > > > + CollectionUri =3D RedfishGetUri (ResourceUri); > > I would like to leave this to Nickle to review if there is any impacts of= not initializing Private->Uri. Is Private->Uri referred in the later proce= ss? > Apart from above, the naming of CollectionUri is not proper as BiosDxe is= not a collection driver. I think the comment of " // Initialize collection= path" is a copy & paste error. > > Thanks > Abner > Good question about Private->Uri. It looks like it's safe not to initialize Private->Uri here, because it is being initialized in every function of EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL. That was exactly my previous concern. After this patch only callee from EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL are dealing with Private->Uri. So it could be dropped in favor of additional parameter. I mean currently EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL function initializes Private->Uri explicitly, then it is used in function implementing actual implementation of EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL. For example: RedfishResourceConsumeResource->RedfishConsumeResourceCommon, RedfishResourceConsumeResource->RedfishConsumeResourceCommon, RedfishResourceProvisioningResource->RedfishProvisioningResourceCommon->{Pr= ovisioningBiosExistResource,ProvisioningBiosResources}, RedfishResourceCheck->RedfishCheckResourceCommon, RedfishResourceUpdate->RedfishUpdateResourceCommon, RedfishResourceIdentify->RedfishIdentifyResourceCommon. So, in all this cases Private->Uri can be passed as a function argument down to call stack. And HandleResource() mentioned above calls functions from EdkIIRedfishResourceConfigLib that in turn calls EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL implementation, where Private->Uri is being initialized. See previous paragraph. I don't think I missed anything. Regards, Mike. > > > > + if (CollectionUri =3D=3D NULL) { > > > > ASSERT (FALSE); > > > > FreePool (ResourceUri); > > > > return EFI_OUT_OF_RESOURCES; > > > > } > > > > > > > > - Status =3D HandleResource (Private, Private->Uri); > > > > + Status =3D HandleResource (Private, CollectionUri); > > > > if (EFI_ERROR (Status)) { > > > > - DEBUG ((DEBUG_ERROR, "%a, process external resource: %a failed: %r= \n", > > __func__, Private->Uri, Status)); > > > > + DEBUG ((DEBUG_ERROR, "%a, process external resource: %s failed: %r= \n", > > __func__, CollectionUri, Status)); > > > > } > > > > > > > > - FreePool (Private->Uri); > > > > + FreePool (CollectionUri); > > > > FreePool (ResourceUri); > > > > return Status; > > > > } > > > > -- > > 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 (#115732): https://edk2.groups.io/g/devel/message/115732 Mute This Topic: https://groups.io/mt/104479572/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-