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>
Signed-off-by: Paul Mackerras <paulus@samba.org>
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;