diff options
| author | Marek Vasut <[email protected]> | 2025-11-24 15:51:01 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-12-27 09:40:35 -0600 |
| commit | 48e56ac26dd925984d599ce06cb769dabb1251d6 (patch) | |
| tree | 4a0a419820a4402567281f78f30109e90da37819 /scripts/basic/Makefile | |
| parent | 5b968372e2136206585d1b0a1c9e9e683127c057 (diff) | |
i2c: Avoid calling dev_read_*() if CONFIG_OF_PLATDATA=y
If CONFIG_OF_PLATDATA=y , then the udevice has no valid OF node associated
with it and ofnode_valid(node) evaluates to 0. The dev_read_u32_default()
call ultimately reaches ofnode_read_u32_index() which invokes fdt_getprop()
and passes result of ofnode_to_offset(node) as an offset parameter into it.
The ofnode_to_offset(node) returns -1 for invalid node, which leads to an
fdt_getprop(..., -1, ...) invocation, which will crash sandbox with SIGSEGV
because libfdt can not handle negative node offsets without full tree check,
which U-Boot inhibits to keep size lower.
Since i2c_child_post_bind() already calls dev_has_ofnode(dev), reuse the
same call and assign i2c->speed_hz = I2C_SPEED_STANDARD_RATE in case the
device has no valid node associated with it, and do not call any of the
dev_read_*() functions for devices without valid nodes.
Signed-off-by: Marek Vasut <[email protected]>
Diffstat (limited to 'scripts/basic/Makefile')
0 files changed, 0 insertions, 0 deletions
