Re: [PATCH 3/4] dm: avoid NULL dereference in lists_bind_fdt()
On Mon, 11 Jul 2022 at 00:21, Heinrich Schuchardt wrote: > > If parameter drv of lists_bind_fdt() is specified, we want to bind to this > specific driver even if its field of_match is NULL. > > If entry->of_match is NULL, we should not dereference it in a debug > statement. > > Fixes: d3e773613b6d ("dm: core: Use U-Boot logging instead of pr_debug()") > Signed-off-by: Heinrich Schuchardt > --- > drivers/core/lists.c | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) > Reviewed-by: Simon Glass Applied to u-boot-dm, thanks!
Re: [PATCH 3/4] dm: avoid NULL dereference in lists_bind_fdt()
On Mon, 11 Jul 2022 at 00:21, Heinrich Schuchardt wrote: > > If parameter drv of lists_bind_fdt() is specified, we want to bind to this > specific driver even if its field of_match is NULL. > > If entry->of_match is NULL, we should not dereference it in a debug > statement. > > Fixes: d3e773613b6d ("dm: core: Use U-Boot logging instead of pr_debug()") > Signed-off-by: Heinrich Schuchardt > --- > drivers/core/lists.c | 7 --- > 1 file changed, 4 insertions(+), 3 deletions(-) > Reviewed-by: Simon Glass
[PATCH 3/4] dm: avoid NULL dereference in lists_bind_fdt()
If parameter drv of lists_bind_fdt() is specified, we want to bind to this specific driver even if its field of_match is NULL. If entry->of_match is NULL, we should not dereference it in a debug statement. Fixes: d3e773613b6d ("dm: core: Use U-Boot logging instead of pr_debug()") Signed-off-by: Heinrich Schuchardt --- drivers/core/lists.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/core/lists.c b/drivers/core/lists.c index 22ccd9faaa..93514a744d 100644 --- a/drivers/core/lists.c +++ b/drivers/core/lists.c @@ -241,9 +241,10 @@ int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp, } } - log_debug(" - found match at '%s': '%s' matches '%s'\n", - entry->name, entry->of_match->compatible, - id->compatible); + if (entry->of_match) + log_debug(" - found match at '%s': '%s' matches '%s'\n", + entry->name, entry->of_match->compatible, + id->compatible); ret = device_bind_with_driver_data(parent, entry, name, id->data, node, ); if (ret == -ENODEV) { -- 2.36.1