blob: ec825cbf7b46918038f265b0e78770982c4ed004 [file] [log] [blame]
Andrew Geissler90fd73c2021-03-05 15:25:55 -06001From 4827e0db6c4f7dea7f4094f49d3bb48ef6dfdc2d Mon Sep 17 00:00:00 2001
2From: David Gibson <david@gibson.dropbear.id.au>
3Date: Wed, 6 Jan 2021 14:52:26 +1100
4Subject: [PATCH] fdtdump: Fix gcc11 warning
5
6In one place, fdtdump abuses fdt_set_magic(), passing it just a small char
7array instead of the full fdt header it expects. That's relying on the
8fact that in fact fdt_set_magic() will only actually access the first 4
9bytes of the buffer.
10
11This trips a new warning in GCC 11 - and it's entirely possible it was
12always UB. So, don't do that.
13
14Upstream-Status: Backport [https://git.kernel.org/pub/scm/utils/dtc/dtc.git/patch/?id=ca16a723fa9dde9c5da80dba567f48715000e77c]
15Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
16---
17 fdtdump.c | 2 +-
18 1 file changed, 1 insertion(+), 1 deletion(-)
19
20diff --git a/fdtdump.c b/fdtdump.c
21index 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--
342.30.1
35