diff options
| author | Marek Vasut <[email protected]> | 2025-11-21 17:17:55 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-12-27 09:01:10 -0600 |
| commit | 00967665f6f91529b6aad266c4b09128da88550b (patch) | |
| tree | e4a984ba00ecb3402906dfccab9bdabd4d400c86 /Kconfig | |
| parent | 3c43ca3025ef424a484101e265b8427e3a364303 (diff) | |
gpio: sandbox: 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 gpio_sandbox_probe() already calls dev_has_ofnode(dev) and assigns
uc_priv->gpio_count to CONFIG_SANDBOX_GPIO_COUNT accordingly, add matching
dev_has_ofnode(dev) check into sandbox_gpio_of_to_plat() and do not call
any of the dev_read_*() functions for devices without valid nodes there
either.
Signed-off-by: Marek Vasut <[email protected]>
Diffstat (limited to 'Kconfig')
0 files changed, 0 insertions, 0 deletions
