Skip to content

Commit

Permalink
RedfishPkg/HostInterfaceBmcUsbNic: Fix potential memory corruption issue
Browse files Browse the repository at this point in the history
Wrong memory allocation issue may result in memory
corruption.

Signed-off-by: Abner Chang <[email protected]>
Cc: Nickle Wang <[email protected]>
Cc: Igor Kulchytskyy <[email protected]>
Cc: Mike Maslenkin <[email protected]>
Reviewed-by: Nickle Wang <[email protected]>
Acked-by: Mike Maslenkin <[email protected]>
  • Loading branch information
changab authored and mergify[bot] committed Dec 5, 2023
1 parent 5cdeff1 commit 120aa60
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 120aa60

Please sign in to comment.