From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: To: Paul Mackerras From: Benjamin Herrenschmidt Date: Wed, 16 May 2007 16:57:24 +1000 Subject: [PATCH] powerpc: Make sure device node type/name is not NULL Message-Id: <20070516065755.5FE9EDDF97@ozlabs.org> Cc: linuxppc-dev@ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- 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 = ""; + if (!node->type) + node->type = ""; + if (!parent) { err = -ENODEV; goto out;