Re: [PATCH 01/15] kobject: Replace ALL occurrences of '/' with '!' instead of only the first one.
- From: Ville Syrjälä <syrjala@xxxxxx>
- Date: Fri, 22 Aug 2008 15:41:53 +0300
On Thu, Aug 21, 2008 at 10:32:49AM -0700, Greg Kroah-Hartman wrote:
From: Ingo Oeser <ioe-lkml@xxxxxxxxxx>
A recent patch from Kay Sievers <kay.sievers@xxxxxxxx>
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 <ioe-lkml@xxxxxxxxxx>
Cc: Kay Sievers <kay.sievers@xxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>
---
lib/kobject.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/lib/kobject.c b/lib/kobject.c
index bd732ff..fbf0ae2 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] = '!';
That's somewhat inefficient. How about this?
s = kobj->name;
while ((s = strchr(s, '/')))
*s++ = '!';
--
Ville Syrjälä
syrjala@xxxxxx
http://www.sci.fi/~syrjala/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- References:
- [GIT PATCH] driver core patches against 2.6.26-rc4
- From: Greg KH
- [PATCH 01/15] kobject: Replace ALL occurrences of '/' with '!' instead of only the first one.
- From: Greg Kroah-Hartman
- [GIT PATCH] driver core patches against 2.6.26-rc4
- Prev by Date: Re: Regression? 2.6.27-rc3 segfault on cold boot; not on warm boot.
- Next by Date: Behaviour of the VM on a embedded linux
- Previous by thread: [PATCH 01/15] kobject: Replace ALL occurrences of '/' with '!' instead of only the first one.
- Next by thread: Re: [PATCH 01/15] kobject: Replace ALL occurrences of '/' with '!' instead of only the first one.
- Index(es):
Relevant Pages
|