summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbner Chang <abner.chang@amd.com>2023-11-27 11:15:35 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-12-05 03:27:03 +0000
commit120aa6064465496c962b6664a9365a2573e54d1f (patch)
treede6fb4a993dc794e53817faa7256bcd0d2eaf1ff
parent5cdeff1eb3533e9791673495f7636f573c39eaf8 (diff)
downloadedk2-120aa6064465496c962b6664a9365a2573e54d1f.tar.gz
edk2-120aa6064465496c962b6664a9365a2573e54d1f.tar.bz2
edk2-120aa6064465496c962b6664a9365a2573e54d1f.zip
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>
-rw-r--r--RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c b/RedfishPkg/Library/PlatformHostInterfaceBmcUsbNicLib/PlatformHostInterfaceBmcUsbNicLib.c
index a4c624208a..7f295fe7f1 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;
}