RedfishPkg/HostInterfaceBmcUsbNic: Fix potential memory corruption issue

Wrong memory allocation issue may result in memory
corruption.

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-27 11:15:35 +08:00 committed by mergify[bot]
parent 5cdeff1eb3
commit 120aa60644
1 changed files with 2 additions and 2 deletions

View File

@ -1060,7 +1060,7 @@ IdentifyUsbNicBmcChannel (
InitializeListHead (&BmcUsbNic->NextInstance);
BmcUsbNic->MacAddressSize = Snp->Mode->HwAddressSize;
BmcUsbNic->MacAddress = AllocateZeroPool (sizeof (BmcUsbNic->MacAddressSize));
BmcUsbNic->MacAddress = AllocatePool (BmcUsbNic->MacAddressSize);
if (BmcUsbNic->MacAddress == NULL) {
DEBUG ((DEBUG_ERROR, " Failed to allocate memory for HW MAC addresss.\n"));
FreePool (BmcUsbNic);
@ -1133,7 +1133,7 @@ CheckBmcUsbNicOnHandles (
(VOID **)&DevicePath
);
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, " Failed to locate device path on %d handle.\n", __func__, Index));
DEBUG ((DEBUG_ERROR, " Failed to locate device path on %d handle.\n", Index));
continue;
}