Hi Patrick, 

On Sun, 28 Feb 2016, Patrick Wildt wrote:

> Hi,
> 
> If we're calling fdt_find_node() and do not actually find the node we're
> looking for, we call strncmp with a NULL value. 
> [...]

Tested on RB600A: boots fine, dmesg unchanged (mod banner). 

Patch applied to HEAD, fdt.c:1.12.

best, 
Richard. 

> diff --git sys/arch/socppc/socppc/fdt.c sys/arch/socppc/socppc/fdt.c
> index 0dec4fb..741763c 100644
> --- sys/arch/socppc/socppc/fdt.c
> +++ sys/arch/socppc/socppc/fdt.c
> @@ -274,6 +274,13 @@ fdt_find_node(char *name)
>  
>               for (child = fdt_child_node(node); child;
>                    child = fdt_next_node(child)) {
> +                     /*
> +                      * A child always starts with a FDT_NODE_BEGIN token.
> +                      * If it's another token, we have reached the end of
> +                      * the list but have not found a match.
> +                      */
> +                     if (betoh32(*(uint32_t *)child) != FDT_NODE_BEGIN)
> +                             return NULL;
>                       if (strncmp(p, fdt_node_name(child), q - p) == 0) {
>                               node = child;
>                               break;
> 
> 

Reply via email to