diff options
author | Khem Raj <raj.khem@gmail.com> | 2021-02-26 23:41:31 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-01 11:12:16 +0000 |
commit | e7dc30cefd8d408cbd8730ab4efde5bf8b681bb1 (patch) | |
tree | 304b6fdafed509e6ee4d7588f2de5d2bc9e2fdef /meta/recipes-kernel | |
parent | 42c9988492254722846a986a436a6ae17af5e199 (diff) | |
download | poky-e7dc30cefd8d408cbd8730ab4efde5bf8b681bb1.tar.gz |
dtc: Fix array-bounds error
Fixes
| libfdt/libfdt.h:251:28: error: array subscript 'struct fdt_header[0]' is partly outside array bounds of 'unsigned char[4]' [-Werror=array-bounds]
| 251 | fdth->name = cpu_to_fdt32(val); \
| | ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
(From OE-Core rev: cd4fe4ec658ce4861fc970149f78b0ca7fda8fe0)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-kernel')
-rw-r--r-- | meta/recipes-kernel/dtc/dtc/0001-fdtdump-Fix-gcc11-warning.patch | 35 | ||||
-rw-r--r-- | meta/recipes-kernel/dtc/dtc_1.6.0.bb | 2 |
2 files changed, 37 insertions, 0 deletions
diff --git a/meta/recipes-kernel/dtc/dtc/0001-fdtdump-Fix-gcc11-warning.patch b/meta/recipes-kernel/dtc/dtc/0001-fdtdump-Fix-gcc11-warning.patch new file mode 100644 index 0000000000..ec825cbf7b --- /dev/null +++ b/meta/recipes-kernel/dtc/dtc/0001-fdtdump-Fix-gcc11-warning.patch | |||
@@ -0,0 +1,35 @@ | |||
1 | From 4827e0db6c4f7dea7f4094f49d3bb48ef6dfdc2d Mon Sep 17 00:00:00 2001 | ||
2 | From: David Gibson <david@gibson.dropbear.id.au> | ||
3 | Date: Wed, 6 Jan 2021 14:52:26 +1100 | ||
4 | Subject: [PATCH] fdtdump: Fix gcc11 warning | ||
5 | |||
6 | In one place, fdtdump abuses fdt_set_magic(), passing it just a small char | ||
7 | array instead of the full fdt header it expects. That's relying on the | ||
8 | fact that in fact fdt_set_magic() will only actually access the first 4 | ||
9 | bytes of the buffer. | ||
10 | |||
11 | This trips a new warning in GCC 11 - and it's entirely possible it was | ||
12 | always UB. So, don't do that. | ||
13 | |||
14 | Upstream-Status: Backport [https://git.kernel.org/pub/scm/utils/dtc/dtc.git/patch/?id=ca16a723fa9dde9c5da80dba567f48715000e77c] | ||
15 | Signed-off-by: David Gibson <david@gibson.dropbear.id.au> | ||
16 | --- | ||
17 | fdtdump.c | 2 +- | ||
18 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
19 | |||
20 | diff --git a/fdtdump.c b/fdtdump.c | ||
21 | index 9613bef..d9fb374 100644 | ||
22 | --- a/fdtdump.c | ||
23 | +++ b/fdtdump.c | ||
24 | @@ -217,7 +217,7 @@ int main(int argc, char *argv[]) | ||
25 | char *p = buf; | ||
26 | char *endp = buf + len; | ||
27 | |||
28 | - fdt_set_magic(smagic, FDT_MAGIC); | ||
29 | + fdt32_st(smagic, FDT_MAGIC); | ||
30 | |||
31 | /* poor man's memmem */ | ||
32 | while ((endp - p) >= FDT_MAGIC_SIZE) { | ||
33 | -- | ||
34 | 2.30.1 | ||
35 | |||
diff --git a/meta/recipes-kernel/dtc/dtc_1.6.0.bb b/meta/recipes-kernel/dtc/dtc_1.6.0.bb index 92df70d9fc..a407137859 100644 --- a/meta/recipes-kernel/dtc/dtc_1.6.0.bb +++ b/meta/recipes-kernel/dtc/dtc_1.6.0.bb | |||
@@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://GPL;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ | |||
5 | 5 | ||
6 | SRCREV = "2525da3dba9beceb96651dc2986581871dbeca30" | 6 | SRCREV = "2525da3dba9beceb96651dc2986581871dbeca30" |
7 | 7 | ||
8 | SRC_URI += "file://0001-fdtdump-Fix-gcc11-warning.patch" | ||
9 | |||
8 | S = "${WORKDIR}/git" | 10 | S = "${WORKDIR}/git" |
9 | 11 | ||
10 | BBCLASSEXTEND = "native nativesdk" | 12 | BBCLASSEXTEND = "native nativesdk" |