diff options
Diffstat (limited to 'src/soc/amd/common/block/pi')
-rw-r--r-- | src/soc/amd/common/block/pi/heapmanager.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/soc/amd/common/block/pi/heapmanager.c b/src/soc/amd/common/block/pi/heapmanager.c index cea3171aa5..d149e9144f 100644 --- a/src/soc/amd/common/block/pi/heapmanager.c +++ b/src/soc/amd/common/block/pi/heapmanager.c @@ -159,11 +159,12 @@ AGESA_STATUS agesa_AllocateBuffer (UINT32 Func, UINTN Data, VOID *ConfigPtr) BestFitPrevNodeOffset); /* - * If BestFitNode is larger than the requested buffer, - * fragment the node further + * If BestFitNode is larger than the requested buffer and + * has room for another buffer node, fragment the node further. */ - if (BestFitNodePtr->BufferSize > - (AllocParams->BufferLength + sizeof(BIOS_BUFFER_NODE))) { + if (BestFitNodePtr->BufferSize >= + (AllocParams->BufferLength + sizeof(BIOS_BUFFER_NODE) + + MIN_BUFFER_NODE_SIZE)) { NextFreeOffset = BestFitNodeOffset + AllocParams->BufferLength + sizeof(BIOS_BUFFER_NODE); |