[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.01.1004201104170.13016@bogon.housecafe.de>
Date: Tue, 20 Apr 2010 11:15:05 -0700 (PDT)
From: Christian Kujau <lists@...dbynature.de>
To: Michael Ellerman <michael@...erman.id.au>
cc: "Rafael J. Wysocki" <rjw@...k.pl>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linuxppc-dev@...abs.org, schwab@...ux-m68k.org,
Kernel Testers List <kernel-testers@...r.kernel.org>,
adobriyan@...il.com, Maciej Rutecki <maciej.rutecki@...il.com>
Subject: Re: [Bug #15589] 2.6.34-rc1: Badness at fs/proc/generic.c:316
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 linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists