From 120aa6064465496c962b6664a9365a2573e54d1f Mon Sep 17 00:00:00 2001 From: Abner Chang Date: Mon, 27 Nov 2023 11:15:35 +0800 Subject: RedfishPkg/HostInterfaceBmcUsbNic: Fix potential memory corruption issue Wrong memory allocation issue may result in memory corruption. Signed-off-by: Abner Chang Cc: Nickle Wang Cc: Igor Kulchytskyy Cc: Mike Maslenkin Reviewed-by: Nickle Wang Acked-by: Mike Maslenkin --- .../PlatformHostInterfaceBmcUsbNicLib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'RedfishPkg/Library') diff --git a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c index a4c6242..7f295fe 100644 --- a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c +++ b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c @@ -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; } -- cgit v1.1