Browse Source

fdtdump: Fix gcc11 warning

In one place, fdtdump abuses fdt_set_magic(), passing it just a small char
array instead of the full fdt header it expects.  That's relying on the
fact that in fact fdt_set_magic() will only actually access the first 4
bytes of the buffer.

This trips a new warning in GCC 11 - and it's entirely possible it was
always UB.  So, don't do that.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
main
David Gibson 4 years ago
parent
commit
ca16a723fa
  1. 2
      fdtdump.c

2
fdtdump.c

@ -217,7 +217,7 @@ int main(int argc, char *argv[])
char *p = buf; char *p = buf;
char *endp = buf + len; char *endp = buf + len;


fdt_set_magic(smagic, FDT_MAGIC); fdt32_st(smagic, FDT_MAGIC);


/* poor man's memmem */ /* poor man's memmem */
while ((endp - p) >= FDT_MAGIC_SIZE) { while ((endp - p) >= FDT_MAGIC_SIZE) {

Loading…
Cancel
Save