From: Ingo Oeser Date: Tue, 22 Jul 2008 23:25:01 +0000 (+0200) Subject: kobject: Replace ALL occurrences of '/' with '!' instead of only the first one. X-Git-Tag: v2.6.27-rc5~54^2~14 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25fdeb3f4468595ab2885687b13515fa848731c2;p=linux-2.6 kobject: Replace ALL occurrences of '/' with '!' instead of only the first one. A recent patch from Kay Sievers 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 Cc: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- diff --git a/lib/kobject.c b/lib/kobject.c index bd732ffebc..fbf0ae2823 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -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);