From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754929Ab0DTSPo (ORCPT ); Tue, 20 Apr 2010 14:15:44 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:64538 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754081Ab0DTSPm convert rfc822-to-8bit (ORCPT ); Tue, 20 Apr 2010 14:15:42 -0400 Date: Tue, 20 Apr 2010 11:15:05 -0700 (PDT) From: Christian Kujau To: Michael Ellerman cc: "Rafael J. Wysocki" , Linux Kernel Mailing List , linuxppc-dev@ozlabs.org, schwab@linux-m68k.org, Kernel Testers List , adobriyan@gmail.com, Maciej Rutecki Subject: Re: [Bug #15589] 2.6.34-rc1: Badness at fs/proc/generic.c:316 In-Reply-To: <1271765898.4324.2.camel@concordia> Message-ID: References: <1271765898.4324.2.camel@concordia> User-Agent: Alpine 2.01 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Provags-ID: V01U2FsdGVkX1/NgjPsYqPnzF6IfCq5ljrmLfl7jN6YXUD+OUm G1p99J4olcWZXWOqk3K7rzCrbNzVkVUwhU69m9Tt4zq0dsqxYI RbJKxLR2Z4Uaqv4DX6dXQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.171]) by ozlabs.org (Postfix) with ESMTP id 7B233B7CF8 for ; Wed, 21 Apr 2010 04:16:03 +1000 (EST) Date: Tue, 20 Apr 2010 11:15:05 -0700 (PDT) From: Christian Kujau To: Michael Ellerman Subject: Re: [Bug #15589] 2.6.34-rc1: Badness at fs/proc/generic.c:316 In-Reply-To: <1271765898.4324.2.camel@concordia> Message-ID: References: <1271765898.4324.2.camel@concordia> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Cc: Linux Kernel Mailing List , "Rafael J. Wysocki" , linuxppc-dev@ozlabs.org, schwab@linux-m68k.org, Kernel Testers List , adobriyan@gmail.com, Maciej Rutecki List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 =E2=80=98unslash_name=E2=80=99: fs/proc/proc_devtree.c:183: error: too few arguments to function =E2=80=98k= strdup=E2=80=99 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!=20 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?= =20 I have not done any performance tests, but I'd rather stick with the=20 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: =09return fixed_name; } =20 +static const char *unslash_name(const char *name) +{ +=09char *p, *fixed_name; + +=09fixed_name =3D kstrdup(name, GFP_KERNEL); +=09if (!fixed_name) { +=09=09printk(KERN_ERR "device-tree: Out of memory trying to unslash " +=09=09=09=09"name \"%s\"\n", name); +=09return name; +=09} + +=09p =3D fixed_name; +=09while ((p =3D strstr(p, "/"))) +=09=09*p++ =3D '_'; + +=09return 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, =09=09if (duplicate_name(de, p)) =09=09=09p =3D fixup_name(np, de, p); =20 +=09=09if (strstr(p, "/")) +=09=09=09p =3D unslash_name(p); + =09=09ent =3D __proc_device_tree_add_prop(de, pp, p); =09=09if (ent =3D=3D NULL) =09=09=09break; --=20 BOFH excuse #369: Virus transmitted from computer to sysadmins. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Kujau Subject: Re: [Bug #15589] 2.6.34-rc1: Badness at fs/proc/generic.c:316 Date: Tue, 20 Apr 2010 11:15:05 -0700 (PDT) Message-ID: References: <1271765898.4324.2.camel@concordia> Mime-Version: 1.0 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <1271765898.4324.2.camel@concordia> Sender: kernel-testers-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-ID: Content-Type: TEXT/PLAIN; charset="utf-8" To: Michael Ellerman Cc: "Rafael J. Wysocki" , Linux Kernel Mailing List , linuxppc-dev-mnsaURCQ41sdnm+yROfE0A@public.gmane.org, schwab-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org, Kernel Testers List , adobriyan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, Maciej Rutecki 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 =E2=80=98unslash_name=E2=80=99: fs/proc/proc_devtree.c:183: error: too few arguments to function =E2=80= =98kstrdup=E2=80=99 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!=20 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 slow= er?=20 I have not done any performance tests, but I'd rather stick with the=20 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; } =20 +static const char *unslash_name(const char *name) +{ + char *p, *fixed_name; + + fixed_name =3D 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 =3D fixed_name; + while ((p =3D strstr(p, "/"))) + *p++ =3D '_'; + + 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 =3D fixup_name(np, de, p); =20 + if (strstr(p, "/")) + p =3D unslash_name(p); + ent =3D __proc_device_tree_add_prop(de, pp, p); if (ent =3D=3D NULL) break; --=20 BOFH excuse #369: Virus transmitted from computer to sysadmins.