RedfishPkg/HostInterfaceBmcUsbNic: Fix incorrect HI protocol record size

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>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Acked-by: Mike Maslenkin <mike.maslenkin@gmail.com>
This commit is contained in:
Abner Chang 2023-11-23 18:42:37 +08:00 committed by mergify[bot]
parent cf31257ec9
commit 5cdeff1eb3
1 changed files with 2 additions and 2 deletions

View File

@ -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