From c3479204cc067cceee43410a596ff434f4e9bf41 Mon Sep 17 00:00:00 2001 From: Oliver Smith-Denny Date: Tue, 22 Jul 2025 10:07:45 -0700 Subject: [PATCH] MdeModulePkg: Unify EfiFileName Parsing The various cores all attempt to print the EfiFileName when loading/dispatching drivers, but they are not unified on approach. This commit ensures they are using the same buffer size and the loop parsing variables are unsigned, as we should not have a negative index. Signed-off-by: Oliver Smith-Denny --- MdeModulePkg/Core/Dxe/Image/Image.c | 2 +- MdeModulePkg/Core/Pei/Image/Image.c | 4 ++-- MdeModulePkg/Core/PiSmmCore/Dispatcher.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MdeModulePkg/Core/Dxe/Image/Image.c b/MdeModulePkg/Core/Dxe/Image/Image.c index 323139e1ab..71d267b3db 100644 --- a/MdeModulePkg/Core/Dxe/Image/Image.c +++ b/MdeModulePkg/Core/Dxe/Image/Image.c @@ -586,7 +586,7 @@ CoreLoadPeImage ( UINTN Size; UINTN Index; UINTN StartIndex; - CHAR8 EfiFileName[256]; + CHAR8 EfiFileName[512]; ZeroMem (&Image->ImageContext, sizeof (Image->ImageContext)); diff --git a/MdeModulePkg/Core/Pei/Image/Image.c b/MdeModulePkg/Core/Pei/Image/Image.c index 24df09cbf3..f74406f4e7 100644 --- a/MdeModulePkg/Core/Pei/Image/Image.c +++ b/MdeModulePkg/Core/Pei/Image/Image.c @@ -625,8 +625,8 @@ PeiLoadImageLoadImage ( EFI_SECTION_TYPE SearchType2; CHAR8 *AsciiString; CHAR8 EfiFileName[512]; - INT32 Index; - INT32 StartIndex; + UINTN Index; + UINTN StartIndex; *EntryPoint = 0; ImageSize = 0; diff --git a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c index c22759db44..2011db1b38 100644 --- a/MdeModulePkg/Core/PiSmmCore/Dispatcher.c +++ b/MdeModulePkg/Core/PiSmmCore/Dispatcher.c @@ -327,7 +327,7 @@ SmmLoadImage ( PE_COFF_LOADER_IMAGE_CONTEXT ImageContext; UINTN Index; UINTN StartIndex; - CHAR8 EfiFileName[256]; + CHAR8 EfiFileName[512]; PERF_LOAD_IMAGE_BEGIN (DriverEntry->ImageHandle);