Don't generate erroneous fixups from reference to path
The dtb overlay format only permits (non local) fixups to reference labels, not paths. That's because the fixup target goes into the property name in the overlay, and property names aren't permitted to include '/' characters. Stop erroneously generating such fixups, because we didn't check for this case. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
50454658f2
commit
e37c25677d
3 changed files with 13 additions and 0 deletions
|
@ -919,6 +919,12 @@ static void add_fixup_entry(struct dt_info *dti, struct node *fn,
|
||||||
/* m->ref can only be a REF_PHANDLE, but check anyway */
|
/* m->ref can only be a REF_PHANDLE, but check anyway */
|
||||||
assert(m->type == REF_PHANDLE);
|
assert(m->type == REF_PHANDLE);
|
||||||
|
|
||||||
|
/* The format only permits fixups for references to label, not
|
||||||
|
* references to path */
|
||||||
|
if (strchr(m->ref, '/'))
|
||||||
|
die("Can't generate fixup for reference to path &{%s}\n",
|
||||||
|
m->ref);
|
||||||
|
|
||||||
/* there shouldn't be any ':' in the arguments */
|
/* there shouldn't be any ':' in the arguments */
|
||||||
if (strchr(node->fullpath, ':') || strchr(prop->name, ':'))
|
if (strchr(node->fullpath, ':') || strchr(prop->name, ':'))
|
||||||
die("arguments should not contain ':'\n");
|
die("arguments should not contain ':'\n");
|
||||||
|
|
6
tests/fixup-ref-to-path.dts
Normal file
6
tests/fixup-ref-to-path.dts
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
/dts-v1/;
|
||||||
|
/plugin/;
|
||||||
|
|
||||||
|
/ {
|
||||||
|
prop = < &{/path/to/node} >;
|
||||||
|
};
|
|
@ -271,6 +271,7 @@ libfdt_overlay_tests () {
|
||||||
run_dtc_test -I dts -O dtb -o $tree.test.dtb "$SRCDIR/$tree.dts"
|
run_dtc_test -I dts -O dtb -o $tree.test.dtb "$SRCDIR/$tree.dts"
|
||||||
run_test overlay_bad_fixup overlay_base_no_symbols.test.dtb $tree.test.dtb
|
run_test overlay_bad_fixup overlay_base_no_symbols.test.dtb $tree.test.dtb
|
||||||
done
|
done
|
||||||
|
run_sh_test "$SRCDIR/dtc-fatal.sh" -I dts -O dtb -o /dev/null fixup-ref-to-path.dts
|
||||||
}
|
}
|
||||||
|
|
||||||
# Tests to exercise dtc's overlay generation support
|
# Tests to exercise dtc's overlay generation support
|
||||||
|
|
Loading…
Reference in a new issue