Commit b9937347 authored by Rob Herring's avatar Rob Herring

scripts/dtc: Update to upstream version 53bf130b1cdd

Sync to upstream dtc commit 53bf130b1cdd ("libfdt: simplify
fdt_node_check_compatible()"). This adds the following commits from
upstream:

53bf130 libfdt: simplify fdt_node_check_compatible()
c9d9121 Warn on node name unit-address presence/absence mismatch
2e53f9d Catch unsigned 32bit overflow when parsing flattened device tree offsets
Signed-off-by: default avatarRob Herring <robh@kernel.org>
parent f55532a0
...@@ -294,6 +294,30 @@ static void check_node_name_format(struct check *c, struct node *dt, ...@@ -294,6 +294,30 @@ static void check_node_name_format(struct check *c, struct node *dt,
} }
NODE_ERROR(node_name_format, NULL, &node_name_chars); NODE_ERROR(node_name_format, NULL, &node_name_chars);
static void check_unit_address_vs_reg(struct check *c, struct node *dt,
struct node *node)
{
const char *unitname = get_unitname(node);
struct property *prop = get_property(node, "reg");
if (!prop) {
prop = get_property(node, "ranges");
if (prop && !prop->val.len)
prop = NULL;
}
if (prop) {
if (!unitname[0])
FAIL(c, "Node %s has a reg or ranges property, but no unit name",
node->fullpath);
} else {
if (unitname[0])
FAIL(c, "Node %s has a unit name, but no reg property",
node->fullpath);
}
}
NODE_WARNING(unit_address_vs_reg, NULL);
static void check_property_name_chars(struct check *c, struct node *dt, static void check_property_name_chars(struct check *c, struct node *dt,
struct node *node, struct property *prop) struct node *node, struct property *prop)
{ {
...@@ -667,6 +691,8 @@ static struct check *check_table[] = { ...@@ -667,6 +691,8 @@ static struct check *check_table[] = {
&addr_size_cells, &reg_format, &ranges_format, &addr_size_cells, &reg_format, &ranges_format,
&unit_address_vs_reg,
&avoid_default_addr_size, &avoid_default_addr_size,
&obsolete_chosen_interrupt_controller, &obsolete_chosen_interrupt_controller,
......
...@@ -889,7 +889,7 @@ struct boot_info *dt_from_blob(const char *fname) ...@@ -889,7 +889,7 @@ struct boot_info *dt_from_blob(const char *fname)
if (version >= 3) { if (version >= 3) {
uint32_t size_str = fdt32_to_cpu(fdt->size_dt_strings); uint32_t size_str = fdt32_to_cpu(fdt->size_dt_strings);
if (off_str+size_str > totalsize) if ((off_str+size_str < off_str) || (off_str+size_str > totalsize))
die("String table extends past total size\n"); die("String table extends past total size\n");
inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str); inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str);
} else { } else {
...@@ -898,7 +898,7 @@ struct boot_info *dt_from_blob(const char *fname) ...@@ -898,7 +898,7 @@ struct boot_info *dt_from_blob(const char *fname)
if (version >= 17) { if (version >= 17) {
size_dt = fdt32_to_cpu(fdt->size_dt_struct); size_dt = fdt32_to_cpu(fdt->size_dt_struct);
if (off_dt+size_dt > totalsize) if ((off_dt+size_dt < off_dt) || (off_dt+size_dt > totalsize))
die("Structure block extends past total size\n"); die("Structure block extends past total size\n");
} }
......
...@@ -647,10 +647,8 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset, ...@@ -647,10 +647,8 @@ int fdt_node_check_compatible(const void *fdt, int nodeoffset,
prop = fdt_getprop(fdt, nodeoffset, "compatible", &len); prop = fdt_getprop(fdt, nodeoffset, "compatible", &len);
if (!prop) if (!prop)
return len; return len;
if (fdt_stringlist_contains(prop, len, compatible))
return 0; return !fdt_stringlist_contains(prop, len, compatible);
else
return 1;
} }
int fdt_node_offset_by_compatible(const void *fdt, int startoffset, int fdt_node_offset_by_compatible(const void *fdt, int startoffset,
......
#define DTC_VERSION "DTC 1.4.1-gb06e55c8" #define DTC_VERSION "DTC 1.4.1-g53bf130b"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment