summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/ovmf
diff options
context:
space:
mode:
authorSteve Sakoman <steve@sakoman.com>2023-01-09 06:51:56 -1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-01-13 18:11:19 +0000
commita9f1e9d27714fa324f4965b826d763f0848457b7 (patch)
tree892989a2171e07cc48c44768053f82840f2baec8 /meta/recipes-core/ovmf
parent2dbbcdb7a6f32b1970620ab967bb0128d7b09b89 (diff)
downloadpoky-a9f1e9d27714fa324f4965b826d763f0848457b7.tar.gz
ovmf: fix gcc12 warning in GenFfs
Backport [https://github.com/tianocore/edk2/commit/7b005f344e533cd913c3ca05b266f9872df886d1] Fixes: 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); | ^~~~~~~~~~~~~~~~~~~~~ (From OE-Core rev: 19da9603f4e7e64d4ffcb6d1e927965dcd161079) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/ovmf')
-rw-r--r--meta/recipes-core/ovmf/ovmf/0001-Basetools-genffs-fix-gcc12-warning.patch49
-rw-r--r--meta/recipes-core/ovmf/ovmf_git.bb1
2 files changed, 50 insertions, 0 deletions
diff --git a/meta/recipes-core/ovmf/ovmf/0001-Basetools-genffs-fix-gcc12-warning.patch b/meta/recipes-core/ovmf/ovmf/0001-Basetools-genffs-fix-gcc12-warning.patch
new file mode 100644
index 0000000000..4418d52898
--- /dev/null
+++ b/meta/recipes-core/ovmf/ovmf/0001-Basetools-genffs-fix-gcc12-warning.patch
@@ -0,0 +1,49 @@
1From 7b005f344e533cd913c3ca05b266f9872df886d1 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
13Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
14Reviewed-by: Bob Feng <bob.c.feng@intel.com>
15
16Upstream-Status: Backport [https://github.com/tianocore/edk2/commit/7b005f344e533cd913c3ca05b266f9872df886d1]
17Signed-off-by: Steve Sakoman <steve@sakoman.com>
18
19---
20 BaseTools/Source/C/GenFfs/GenFfs.c | 2 +-
21 BaseTools/Source/C/GenSec/GenSec.c | 2 +-
22 2 files changed, 2 insertions(+), 2 deletions(-)
23
24diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
25index 949025c33325..d78d62ab3689 100644
26--- a/BaseTools/Source/C/GenFfs/GenFfs.c
27+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
28@@ -542,7 +542,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
29 PeFileBuffer = (UINT8 *) malloc (PeFileSize);
30 if (PeFileBuffer == NULL) {
31 fclose (InFileHandle);
32- Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle);
33+ Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
34 return EFI_OUT_OF_RESOURCES;
35 }
36 fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
37diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c
38index d54a4f9e0a7d..b1d05367ec0b 100644
39--- a/BaseTools/Source/C/GenSec/GenSec.c
40+++ b/BaseTools/Source/C/GenSec/GenSec.c
41@@ -1062,7 +1062,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
42 PeFileBuffer = (UINT8 *) malloc (PeFileSize);
43 if (PeFileBuffer == NULL) {
44 fclose (InFileHandle);
45- Error(NULL, 0, 4001, "Resource", "memory cannot be allocated of %s", InFileHandle);
46+ Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
47 return EFI_OUT_OF_RESOURCES;
48 }
49 fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
diff --git a/meta/recipes-core/ovmf/ovmf_git.bb b/meta/recipes-core/ovmf/ovmf_git.bb
index b00119313b..63e857737a 100644
--- a/meta/recipes-core/ovmf/ovmf_git.bb
+++ b/meta/recipes-core/ovmf/ovmf_git.bb
@@ -18,6 +18,7 @@ SRC_URI = "gitsm://github.com/tianocore/edk2.git;branch=master;protocol=https \
18 file://0003-ovmf-enable-long-path-file.patch \ 18 file://0003-ovmf-enable-long-path-file.patch \
19 file://0004-ovmf-Update-to-latest.patch \ 19 file://0004-ovmf-Update-to-latest.patch \
20 file://0001-Fix-VLA-parameter-warning.patch \ 20 file://0001-Fix-VLA-parameter-warning.patch \
21 file://0001-Basetools-genffs-fix-gcc12-warning.patch \
21 " 22 "
22 23
23PV = "edk2-stable202008" 24PV = "edk2-stable202008"