Re: [Bug #15589] 2.6.34-rc1: Badness at fs/proc/generic.c:316

Christian Kujau
2010-05-09T22:28:12Z

On Sun, 9 May 2010 at 23:17, Rafael J. Wysocki wrote:
> Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15589
> Subject : 2.6.34-rc1: Badness at fs/proc/generic.c:316
> Submitter : Christian Kujau <lists@nerdbynature.de>
> Date : 2010-03-13 23:53 (58 days old)
> Message-ID : <<alpine.DEB.2.01.1003131544340.5493@bogon.housecafe.de>>
> References : http://marc.info/?l=linux-kernel&m=126852442903680&w=2

The bug is still present in -rc6, but Michael Ellerman has a patch[0]
which made the warning go away.

@Michael: will you post your patch with a Sign-Off, so that it can be
pushed into mainline?

Thanks,
Christian.

[0] http://patchwork.ozlabs.org/patch/50557/

diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c
index ce94801..019581d 100644
--- a/fs/proc/proc_devtree.c
+++ b/fs/proc/proc_devtree.c
@@ -176,6 +176,24 @@ retry:
return fixed_name;
}

+static const char *unslash_name(const char *name)
+{
+ char *p, *fixed_name;
+
+ fixed_name = kstrdup(name, GFP_KERNEL);
+ if (!fixed_name) {
+ printk(KERN_ERR "device-tree: Out of memory trying to unslash "
+ "name \"%s\"\n", name);
+ return name;
+ }
+
+ p = fixed_name;
+ while ((p = strstr(p, "/")))
+ *p++ = '_';
+
+ return fixed_name;
+}
+
/*
* Process a node, adding entries for its children and its properties.
*/
@@ -212,6 +230,9 @@ void proc_device_tree_add_node(struct device_node *np,
if (duplicate_name(de, p))
p = fixup_name(np, de, p);

+ if (strstr(p, "/"))
+ p = unslash_name(p);
+
ent = __proc_device_tree_add_prop(de, pp, p);
if (ent == NULL)
break;
--
BOFH excuse #188:

..disk or the processor is on fire.