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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 20 Apr 2010 at 22:18, Michael Ellerman wrote:
> Try this 100% unbuilt, 100% untested patch.

I added GFP_KERNEL to kstrdup to make the compile error go away:

fs/proc/proc_devtree.c: In function ‘unslash_name’:
fs/proc/proc_devtree.c:183: error: too few arguments to function ‘kstrdup’
make[2]: *** [fs/proc/proc_devtree.o] Error 1
make[1]: *** [fs/proc] Error 2
make: *** [fs] Error 2

And now 2.6.34-rc5 compiles and boots without the warning. Thanks! 
New dmesg and /proc/device-tree on:

  http://nerdbynature.de/bits/2.6.34-rc1/xlate_proc_name/

Alexey mentioned that this is "wasteful" - does it make the kernel slower? 
I have not done any performance tests, but I'd rather stick with the 
warning than make this Powerbook G4 any more slower :-\


Thanks again,
Christian.

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 #369:

Virus transmitted from computer to sysadmins.
--
To unsubscribe from this list: send the line "unsubscribe kernel-testers" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux