summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/ovmf/ovmf/0001-BaseTools-fix-gcc12-warning.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2022-05-13 09:22:44 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-15 08:57:16 +0100
commit2f36d912d4cb12d51c13f685fb712a241a27baf7 (patch)
treecf19720b852faa2ecb8e90e6119c01698546d11a /meta/recipes-core/ovmf/ovmf/0001-BaseTools-fix-gcc12-warning.patch
parent9353730a6be40763710b2d928904012bf7771305 (diff)
downloadpoky-2f36d912d4cb12d51c13f685fb712a241a27baf7.tar.gz
ovmf: Fix native build with gcc-12
Host distros have started deploying gcc12 as well e.g. archlinux this build failure shows up which has been fixed upstream In function ‘GetAlignmentFromFile’, inlined from ‘main’ at GenFfs.c:816:20: 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); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ (From OE-Core rev: 7b67f19d353d88107f52cceda3c858730ac1db54) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/ovmf/ovmf/0001-BaseTools-fix-gcc12-warning.patch')
-rw-r--r--meta/recipes-core/ovmf/ovmf/0001-BaseTools-fix-gcc12-warning.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/meta/recipes-core/ovmf/ovmf/0001-BaseTools-fix-gcc12-warning.patch b/meta/recipes-core/ovmf/ovmf/0001-BaseTools-fix-gcc12-warning.patch
new file mode 100644
index 0000000000..91c01647db
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0001-BaseTools-fix-gcc12-warning.patch
@@ -0,0 +1,49 @@
1From 2435c17e56652479315853cec5b91fb0ea0911a3 Mon Sep 17 00:00:00 2001
2From: Gerd Hoffmann <kraxel@redhat.com>
3Date: Thu, 24 Mar 2022 20:04:34 +0800
4Subject: [PATCH] BaseTools: fix gcc12 warning
5
6GenFfs.c:545:5: error: pointer ?InFileHandle? used after ?fclose? [-Werror=use-after-free]
7 545 | Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle);
8 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9GenFfs.c:544:5: note: call to ?fclose? here
10 544 | fclose (InFileHandle);
11 | ^~~~~~~~~~~~~~~~~~~~~
12
13Upstream-Status: Backport [https://github.com/tianocore/edk2/commit/7b005f344e533cd913c3ca05b266f9872df886d1]
14Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15Reviewed-by: Bob Feng <bob.c.feng@intel.com>
16---
17 BaseTools/Source/C/GenFfs/GenFfs.c | 2 +-
18 BaseTools/Source/C/GenSec/GenSec.c | 2 +-
19 2 files changed, 2 insertions(+), 2 deletions(-)
20
21diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
22index 949025c333..d78d62ab36 100644
23--- a/BaseTools/Source/C/GenFfs/GenFfs.c
24+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
25@@ -542,7 +542,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
26 PeFileBuffer = (UINT8 *) malloc (PeFileSize);
27 if (PeFileBuffer == NULL) {
28 fclose (InFileHandle);
29- Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle);
30+ Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
31 return EFI_OUT_OF_RESOURCES;
32 }
33 fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
34diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c
35index d54a4f9e0a..b1d05367ec 100644
36--- a/BaseTools/Source/C/GenSec/GenSec.c
37+++ b/BaseTools/Source/C/GenSec/GenSec.c
38@@ -1062,7 +1062,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
39 PeFileBuffer = (UINT8 *) malloc (PeFileSize);
40 if (PeFileBuffer == NULL) {
41 fclose (InFileHandle);
42- Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle);
43+ Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
44 return EFI_OUT_OF_RESOURCES;
45 }
46 fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
47--
482.36.1
49