Skip to content

Commit

Permalink
fdtdump: Fix over-zealous version check
Browse files Browse the repository at this point in the history
It's perfectly valid for a dtb to have version and last compat version set
to the same value, and that value can be 17 (the latest defined version).
However, since 0931cea "dtc: fdtdump: check fdt if not in scanning mode"
fdtdump will refuse to process such a dtb.  We get away with this in many
cases because dtc's typical output has last compat version equal to 16,
rather than 17, but it's still a bug.

Signed-off-by: David Gibson <[email protected]>
  • Loading branch information
dgibson committed Apr 18, 2017
1 parent 9067ee4 commit c225884
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fdtdump.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ static bool valid_header(char *p, off_t len)
if (len < sizeof(struct fdt_header) ||
fdt_magic(p) != FDT_MAGIC ||
fdt_version(p) > MAX_VERSION ||
fdt_last_comp_version(p) >= MAX_VERSION ||
fdt_last_comp_version(p) > MAX_VERSION ||
fdt_totalsize(p) >= len ||
fdt_off_dt_struct(p) >= len ||
fdt_off_dt_strings(p) >= len)
Expand Down

0 comments on commit c225884

Please sign in to comment.