linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@ozlabs.org
Subject: [PATCH] powerpc: Make sure device node type/name is not NULL
Date: Wed, 16 May 2007 16:57:24 +1000	[thread overview]
Message-ID: <20070516065755.5FE9EDDF97@ozlabs.org> (raw)

Our device-tree unflattening code makes sure the name and type
fields of a device-node are not NULL. However, the code for dynamically
adding devices nodes which is used for pSeries hotplug for example didn't
do it, potentially causing crashes in some code that assume it can
always do things like strcmp on those.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

---

 arch/powerpc/kernel/prom.c |    5 +++++
 1 file changed, 5 insertions(+)

Index: linux-cell/arch/powerpc/kernel/prom.c
===================================================================
--- linux-cell.orig/arch/powerpc/kernel/prom.c	2007-05-14 16:32:34.000000000 +1000
+++ linux-cell/arch/powerpc/kernel/prom.c	2007-05-16 16:52:08.000000000 +1000
@@ -1472,6 +1472,11 @@ static int of_finish_dynamic_node(struct
 	node->name = of_get_property(node, "name", NULL);
 	node->type = of_get_property(node, "device_type", NULL);
 
+	if (!node->name)
+		node->name = "<NULL>";
+	if (!node->type)
+		node->type = "<NULL>";
+
 	if (!parent) {
 		err = -ENODEV;
 		goto out;

                 reply	other threads:[~2007-05-16  6:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20070516065755.5FE9EDDF97@ozlabs.org \
    --to=benh@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).