On Thu, Aug 14, 2008 at 08:28:19AM -0500, Kumar Gala wrote:
> -     if (*path != '/')
> -             return -FDT_ERR_BADPATH;
> +     /* see if we have an alias */
> +     if (*path != '/') {
> +             const char *q;
> +             int aliasoffset = fdt_path_offset(fdt, "/aliases");
> +
> +             if (aliasoffset < 0)
> +                     return -FDT_ERR_BADPATH;
> +
> +             q = strchr(path, '/');
> +             if (!q)
> +                     q = end;
> +
> +             p = fdt_getprop_namelen(fdt, aliasoffset, path, q - p, NULL);
> +             if (!p)
> +                     return -FDT_ERR_BADPATH;
> +             offset = fdt_path_offset(fdt, p);
> +
> +             p = q;
> +     }

Can we limit the recursion depth to avoid falling off the stack if an
alias points to itself?  Or if aliases pointing to aliases are
disallowed, check for a leading '/' before recursively calling
fdt_path_offset.

-Scott
_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to