mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-25 14:44:28 +02:00
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:
parent
5cdeff1eb3
commit
120aa60644
@ -1060,7 +1060,7 @@ IdentifyUsbNicBmcChannel (
|
|||||||
|
|
||||||
InitializeListHead (&BmcUsbNic->NextInstance);
|
InitializeListHead (&BmcUsbNic->NextInstance);
|
||||||
BmcUsbNic->MacAddressSize = Snp->Mode->HwAddressSize;
|
BmcUsbNic->MacAddressSize = Snp->Mode->HwAddressSize;
|
||||||
BmcUsbNic->MacAddress = AllocateZeroPool (sizeof (BmcUsbNic->MacAddressSize));
|
BmcUsbNic->MacAddress = AllocatePool (BmcUsbNic->MacAddressSize);
|
||||||
if (BmcUsbNic->MacAddress == NULL) {
|
if (BmcUsbNic->MacAddress == NULL) {
|
||||||
DEBUG ((DEBUG_ERROR, " Failed to allocate memory for HW MAC addresss.\n"));
|
DEBUG ((DEBUG_ERROR, " Failed to allocate memory for HW MAC addresss.\n"));
|
||||||
FreePool (BmcUsbNic);
|
FreePool (BmcUsbNic);
|
||||||
@ -1133,7 +1133,7 @@ CheckBmcUsbNicOnHandles (
|
|||||||
(VOID **)&DevicePath
|
(VOID **)&DevicePath
|
||||||
);
|
);
|
||||||
if (EFI_ERROR (Status)) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user