Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:olh:xen-4.17
xen
ovmf.7b005f344e533cd913c3ca05b266f9872df886d1.p...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ovmf.7b005f344e533cd913c3ca05b266f9872df886d1.patch of Package xen
From: Gerd Hoffmann <kraxel@redhat.com> Date: Thu, 24 Mar 2022 20:04:34 +0800 Subject: 7b005f344e533cd913c3ca05b266f9872df886d1 BaseTools: fix gcc12 warning GenFfs.c:545:5: error: pointer ?InFileHandle? used after ?fclose? [-Werror=use-after-free] 545 | Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GenFfs.c:544:5: note: call to ?fclose? here 544 | fclose (InFileHandle); | ^~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> --- BaseTools/Source/C/GenFfs/GenFfs.c | 2 +- BaseTools/Source/C/GenSec/GenSec.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/BaseTools/Source/C/GenFfs/GenFfs.c +++ b/BaseTools/Source/C/GenFfs/GenFfs.c @@ -533,25 +533,25 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment) memset (&ImageContext, 0, sizeof (ImageContext)); InFileHandle = fopen(LongFilePath(InFile), "rb"); if (InFileHandle == NULL){ Error (NULL, 0, 0001, "Error opening file", InFile); return EFI_ABORTED; } PeFileSize = _filelength (fileno(InFileHandle)); PeFileBuffer = (UINT8 *) malloc (PeFileSize); if (PeFileBuffer == NULL) { fclose (InFileHandle); - Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle); + Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile); return EFI_OUT_OF_RESOURCES; } fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle); fclose (InFileHandle); CommonHeader = (EFI_COMMON_SECTION_HEADER *) PeFileBuffer; CurSecHdrSize = GetSectionHeaderLength(CommonHeader); ImageContext.Handle = (VOID *) ((UINTN)PeFileBuffer + CurSecHdrSize); ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE)FfsRebaseImageRead; Status = PeCoffLoaderGetImageInfo(&ImageContext); if (EFI_ERROR (Status)) { Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and return status is %x", InFile, (int) Status); return Status; --- a/BaseTools/Source/C/GenSec/GenSec.c +++ b/BaseTools/Source/C/GenSec/GenSec.c @@ -1053,25 +1053,25 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment) memset (&ImageContext, 0, sizeof (ImageContext)); InFileHandle = fopen(LongFilePath(InFile), "rb"); if (InFileHandle == NULL){ Error (NULL, 0, 0001, "Error opening file", InFile); return EFI_ABORTED; } PeFileSize = _filelength (fileno(InFileHandle)); PeFileBuffer = (UINT8 *) malloc (PeFileSize); if (PeFileBuffer == NULL) { fclose (InFileHandle); - Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle); + Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile); return EFI_OUT_OF_RESOURCES; } fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle); fclose (InFileHandle); CommonHeader = (EFI_COMMON_SECTION_HEADER *) PeFileBuffer; CurSecHdrSize = GetSectionHeaderLength(CommonHeader); ImageContext.Handle = (VOID *) ((UINTN)PeFileBuffer + CurSecHdrSize); ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE)FfsRebaseImageRead; Status = PeCoffLoaderGetImageInfo(&ImageContext); if (EFI_ERROR (Status)) { Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and return status is %x", InFile, (int) Status); return Status;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor