public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Chang, Abner via groups.io" <abner.chang=amd.com@groups.io>
To: Pedro Falcato <pedro.falcato@gmail.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"mike.maslenkin@gmail.com" <mike.maslenkin@gmail.com>
Cc: Nickle Wang <nicklew@nvidia.com>, Igor Kulchytskyy <igork@ami.com>
Subject: Re: [edk2-devel] [RFC PATCH] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses
Date: Fri, 15 Dec 2023 00:17:31 +0000	[thread overview]
Message-ID: <MN2PR12MB39666FB144DF5733A82515BEEA93A@MN2PR12MB3966.namprd12.prod.outlook.com> (raw)
In-Reply-To: <CAKbZUD1aB62ey-jRx2TE0X2XFOdzCqcOf1nJHasm-02FhziOjg@mail.gmail.com>

[AMD Official Use Only - General]

> -----Original Message-----
> From: Pedro Falcato <pedro.falcato@gmail.com>
> Sent: Wednesday, December 13, 2023 9:15 PM
> To: devel@edk2.groups.io; mike.maslenkin@gmail.com
> Cc: Chang, Abner <Abner.Chang@amd.com>; Nickle Wang
> <nicklew@nvidia.com>; Igor Kulchytskyy <igork@ami.com>
> Subject: Re: [edk2-devel] [RFC PATCH] RedfishPkg: RedfishDiscoverDxe: add []
> brackets to URI for IPv6 addresses
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> On Thu, Dec 7, 2023 at 1:24 PM Mike Maslenkin
> <mike.maslenkin@gmail.com> wrote:
> >
> > URI is generated based on the RedfishLocation containing an ASCII string
> > representing the IP address. So, in the case of IPv4 the canonical
> > representation of an IPv4 address was inserted into the resulting Unicode
> > string i.e: "http{,s}://X.X.X.X/".
> >
> > In the case of IPv6, to access resources, the IP address must be specified
> > in brackets, i.e. the resulting string should look like:
> >   "http{,s}://[X::X:X:X:X]/".
> >
> > Cc: Abner Chang <abner.chang@amd.com>
> > Cc: Nickle Wang <nicklew@nvidia.com>
> > Cc: Igor Kulchytskyy <igork@ami.com>
> > Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
> > ---
> >  .../RedfishDiscoverDxe/RedfishDiscoverDxe.c   | 20 ++++++++++++++++---
> >  1 file changed, 17 insertions(+), 3 deletions(-)
> >
> > diff --git a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > index 28ba2d3a9fca..49c96bd28b27 100644
> > --- a/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > +++ b/RedfishPkg/RedfishDiscoverDxe/RedfishDiscoverDxe.c
> > @@ -863,9 +863,23 @@ AddAndSignalNewRedfishService (
> >      }
> >
> >      if (RedfishLocation != NULL) {
> > -      DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool
> (AsciiStrSize ((const CHAR8 *)RedfishLocation) * sizeof (CHAR16));
> > -      AsciiStrToUnicodeStrS ((const CHAR8 *)RedfishLocation,
> DiscoveredInstance->Information.Location, AsciiStrSize ((const CHAR8
> *)RedfishLocation) * sizeof (CHAR16));
> > -      DEBUG ((DEBUG_MANAGEABILITY, "Redfish service location: %s.\n",
> DiscoveredInstance->Information.Location));
> > +      UINTN        AllocSize;
> > +      CONST CHAR8  *IpAddress;
> > +
> > +      IpAddress = (CONST CHAR8 *)RedfishLocation;
> > +      AllocSize = AsciiStrSize (IpAddress) * sizeof (CHAR16);
> > +
> > +      if (CheckIsIpVersion6 (NetworkInterface)) {
> > +        AllocSize += 2 * sizeof (CHAR16); // take into account '[' and ']'
> > +
> > +        DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool
> (AllocSize);
>
> You don't check for NULL.
>
> > +        UnicodeSPrintAsciiFormat (DiscoveredInstance->Information.Location,
> AllocSize, "[%a]", IpAddress);
> > +      } else {
> > +        DiscoveredInstance->Information.Location = (CHAR16 *)AllocatePool
> (AllocSize);
>
> You don't check for NULL.
> Heck, why does no one check for NULL in this whole function
> (AddAndSignalNewRedfishService)?
Yes, we should check it. Could you please create a Bugzilla ticket for this?

Thanks
Abner

>
> --
> Pedro


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112578): https://edk2.groups.io/g/devel/message/112578
Mute This Topic: https://groups.io/mt/103033764/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2023-12-15  0:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07 13:24 [edk2-devel] [RFC PATCH] RedfishPkg: RedfishDiscoverDxe: add [] brackets to URI for IPv6 addresses Mike Maslenkin
2023-12-13 11:09 ` Chang, Abner via groups.io
2023-12-13 13:15 ` Pedro Falcato
2023-12-13 13:35   ` Mike Maslenkin
2023-12-13 13:38     ` Chang, Abner via groups.io
2023-12-15  0:17   ` Chang, Abner via groups.io [this message]
2023-12-13 13:28 ` Pedro Falcato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR12MB39666FB144DF5733A82515BEEA93A@MN2PR12MB3966.namprd12.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox