kobject: Replace ALL occurrences of '/' with '!' instead of only the first one.
authorIngo Oeser <[email protected]>
Tue, 22 Jul 2008 23:25:01 +0000 (01:25 +0200)
committerGreg Kroah-Hartman <[email protected]>
Thu, 21 Aug 2008 17:15:34 +0000 (10:15 -0700)
A recent patch from Kay Sievers <[email protected]>
replaced the first occurrence of '/' with '!' as needed for block devices.

Now do some cheap defensive coding and replace all of them to avoid future
issues in this area.

Signed-off-by: Ingo Oeser <[email protected]>
Cc: Kay Sievers <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
lib/kobject.c

index bd732ffebc85f36cfc30e70fa124f0566701ecba..fbf0ae28237672a6fafdbbf29e481d76c45ddd11 100644 (file)
@@ -223,8 +223,7 @@ static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
                return -ENOMEM;
 
        /* ewww... some of these buggers have '/' in the name ... */
-       s = strchr(kobj->name, '/');
-       if (s)
+       while ((s = strchr(kobj->name, '/')))
                s[0] = '!';
 
        kfree(old_name);