edk2/0030-BaseTools-fix-gcc12-warning.patch
Gerd Hoffmann e3d786aa1d add gcc12 fixes
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2022-03-24 13:01:23 +01:00

51 lines
2.2 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 84d64059dd0082609a43c7938a8a35e10da10706 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Mon, 24 Jan 2022 11:03:25 +0100
Subject: [PATCH 30/32] BaseTools: fix gcc12 warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>
---
BaseTools/Source/C/GenFfs/GenFfs.c | 2 +-
BaseTools/Source/C/GenSec/GenSec.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
index 949025c33325..d78d62ab3689 100644
--- a/BaseTools/Source/C/GenFfs/GenFfs.c
+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -542,7 +542,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
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);
diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c
index d54a4f9e0a7d..b1d05367ec0b 100644
--- a/BaseTools/Source/C/GenSec/GenSec.c
+++ b/BaseTools/Source/C/GenSec/GenSec.c
@@ -1062,7 +1062,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
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);
--
2.35.1