lkml.org 
[lkml]   [2015]   [Sep]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] drivers: of: check input parameter name for __of_find_property
From
Date
On 09/11/2015 08:44 AM, Peng Fan wrote:
> Check input parameter 'name' for __of_find_property. If name is NULL,
> of_prop_cmp->strcasecmp may trigger panic.

Arguably that could be a feature. Do you have a usecase where name being
NULL is valid and panicking is a problem?

Rob

>
> Signed-off-by: Peng Fan <van.freenix@gmail.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Frank Rowand <frowand.list@gmail.com>
> Cc: Grant Likely <grant.likely@linaro.org>
> ---
> drivers/of/base.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 8b5a187..e41436d 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -215,7 +215,7 @@ static struct property *__of_find_property(const struct device_node *np,
> {
> struct property *pp;
>
> - if (!np)
> + if (!np || !name)
> return NULL;
>
> for (pp = np->properties; pp; pp = pp->next) {
>



\
 
 \ /
  Last update: 2015-09-15 18:21    [W:1.120 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site