From: "Mike Maslenkin" <mike.maslenkin@gmail.com>
To: abner.chang@amd.com
Cc: devel@edk2.groups.io, Nickle Wang <nicklew@nvidia.com>,
Igor Kulchytskyy <igork@ami.com>
Subject: Re: [edk2-devel] [PATCH V2 8/8] RedfishPkg/HostInterfaceBmcUsbNic: Fix incorrect HI protocol record size
Date: Sun, 26 Nov 2023 22:30:23 +0300 [thread overview]
Message-ID: <CAL77WPA8q3M7_DmEkRZkf1uE6th=BEUWb0tg6ZnUPY-R1OmqGw@mail.gmail.com> (raw)
In-Reply-To: <20231123064719.1248-9-abner.chang@amd.com>
On Thu, Nov 23, 2023 at 9:48 AM <abner.chang@amd.com> wrote:
>
> From: Abner Chang <abner.chang@amd.com>
>
> The size of structure must be minus with byte that is
> occupied by the initial array.
>
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
> ---
> .../PlatformHostInterfaceBmcUsbNicLib.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
> index c4a71226e63..a1ce2dd3d93 100644
> --- a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
> +++ b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
> @@ -180,7 +180,7 @@ RedfishPlatformHostInterfaceProtocolData (
> HostNameLength = (UINT8)AsciiStrSize (HostNameString);
> ThisProtocolRecord = (MC_HOST_INTERFACE_PROTOCOL_RECORD *)AllocateZeroPool (
> sizeof (MC_HOST_INTERFACE_PROTOCOL_RECORD) - 1 +
> - sizeof (REDFISH_OVER_IP_PROTOCOL_DATA) +
> + sizeof (REDFISH_OVER_IP_PROTOCOL_DATA) - 1 +
> HostNameLength
> );
> if (ThisProtocolRecord == NULL) {
> @@ -189,7 +189,7 @@ RedfishPlatformHostInterfaceProtocolData (
> }
>
> ThisProtocolRecord->ProtocolType = MCHostInterfaceProtocolTypeRedfishOverIP;
> - ThisProtocolRecord->ProtocolTypeDataLen = sizeof (REDFISH_OVER_IP_PROTOCOL_DATA) + HostNameLength;
> + ThisProtocolRecord->ProtocolTypeDataLen = sizeof (REDFISH_OVER_IP_PROTOCOL_DATA) -1 + HostNameLength;
> RedfishOverIpData = (REDFISH_OVER_IP_PROTOCOL_DATA *)&ThisProtocolRecord->ProtocolTypeData[0];
> //
> // Fill up REDFISH_OVER_IP_PROTOCOL_DATA
> --
> 2.37.1.windows.1
>
Excellent!
BTW could we use zero-sized array for
REDFISH_OVER_IP_PROTOCOL_DATA::RedfishServiceHostname?
Alternatively, we could use "HostNameLength = (UINT8) AsciiStrLen
(HostNameString);" with appropriate comment, that space for \0 is
already reserved,
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111704): https://edk2.groups.io/g/devel/message/111704
Mute This Topic: https://groups.io/mt/102763123/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2023-11-26 19:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-23 6:47 [edk2-devel] [PATCH V2 0/8] Refine BMC USB NIC discovery and Redfish service enablement Chang, Abner via groups.io
2023-11-23 6:47 ` [edk2-devel] [PATCH V2 1/8] RedfishPkg/BmcUsbNicLib: Update BMC USB NIC searching algorithm Chang, Abner via groups.io
2023-11-26 19:38 ` Mike Maslenkin
2023-11-27 4:32 ` Chang, Abner via groups.io
2023-11-23 6:47 ` [edk2-devel] [PATCH V2 2/8] RedfishPkg/RedfishHostInterfaceDxe: Add Redfish HI readiness notification Chang, Abner via groups.io
2023-11-26 19:35 ` Mike Maslenkin
2023-11-27 4:33 ` Chang, Abner via groups.io
2023-11-23 6:47 ` [edk2-devel] [PATCH V2 3/8] RedfishPkg/RedfishConfigHandler: Use " Chang, Abner via groups.io
2023-11-23 6:47 ` [edk2-devel] [PATCH V2 4/8] RedfishPkg/RedfishConfigHandler: Correct the prototype of callback function Chang, Abner via groups.io
2023-11-23 6:47 ` [edk2-devel] [PATCH V2 5/8] RedfishPkg/RedfishDiscovery: Add more debug message Chang, Abner via groups.io
2023-11-23 6:47 ` [edk2-devel] [PATCH V2 6/8] RedfishPkg/RedfishDiscovery: Refine SMBIOS 42h code Chang, Abner via groups.io
2023-11-23 6:47 ` [edk2-devel] [PATCH V2 7/8] RedfishPkg/HostInterfaceBmcUsbNic: Fix incorrect reference of MAC address pointer Chang, Abner via groups.io
2023-11-23 6:47 ` [edk2-devel] [PATCH V2 8/8] RedfishPkg/HostInterfaceBmcUsbNic: Fix incorrect HI protocol record size Chang, Abner via groups.io
2023-11-26 19:30 ` Mike Maslenkin [this message]
2023-11-27 4:38 ` Chang, Abner via groups.io
2023-11-26 19:46 ` [edk2-devel] [PATCH V2 0/8] Refine BMC USB NIC discovery and Redfish service enablement Mike Maslenkin
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='CAL77WPA8q3M7_DmEkRZkf1uE6th=BEUWb0tg6ZnUPY-R1OmqGw@mail.gmail.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