All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <van.freenix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	van.freenix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Frank Rowand
	<frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Grant Likely
	<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: [PATCH] drivers: of: check input parameter name for __of_find_property
Date: Fri, 11 Sep 2015 21:44:03 +0800	[thread overview]
Message-ID: <1441979043-19694-1-git-send-email-van.freenix@gmail.com> (raw)

Check input parameter 'name' for __of_find_property. If name is NULL,
of_prop_cmp->strcasecmp may trigger panic.

Signed-off-by: Peng Fan <van.freenix-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Frank Rowand <frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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) {
-- 
1.8.4

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Peng Fan <van.freenix@gmail.com>
To: robh+dt@kernel.org
Cc: devicetree@vger.kernel.org, van.freenix@gmail.com,
	linux-kernel@vger.kernel.org,
	Frank Rowand <frowand.list@gmail.com>,
	Grant Likely <grant.likely@linaro.org>
Subject: [PATCH] drivers: of: check input parameter name for __of_find_property
Date: Fri, 11 Sep 2015 21:44:03 +0800	[thread overview]
Message-ID: <1441979043-19694-1-git-send-email-van.freenix@gmail.com> (raw)

Check input parameter 'name' for __of_find_property. If name is NULL,
of_prop_cmp->strcasecmp may trigger panic.

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) {
-- 
1.8.4


             reply	other threads:[~2015-09-11 13:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-11 13:44 Peng Fan [this message]
2015-09-11 13:44 ` [PATCH] drivers: of: check input parameter name for __of_find_property Peng Fan
2015-09-15 15:56 ` Rob Herring
2015-09-16  0:16   ` Peng Fan
     [not found]     ` <20150916001650.GA28082-12w76u+6CWdQVMFFLWfSwA@public.gmane.org>
2015-09-16  2:27       ` Rob Herring
2015-09-16  2:27         ` Rob Herring
2015-09-16 13:55         ` Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1441979043-19694-1-git-send-email-van.freenix@gmail.com \
    --to=van.freenix-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.