Commit 1c710c64 authored by Linda Xie's avatar Linda Xie Committed by Greg Kroah-Hartman

[PATCH] symlink doesn't support kobj name > 20 charaters (KOBJ_NAME_LEN)

Since symlink.c uses "name" field of a kobj when it calculates the
length,  it gets a wrong value if the kobj's name  has more than 20
charathers.  A correct way to do that is to call kobject_name(kobj)
instead of using kobj->name directly.
parent c0b3a38f
...@@ -42,7 +42,7 @@ static int object_path_length(struct kobject * kobj) ...@@ -42,7 +42,7 @@ static int object_path_length(struct kobject * kobj)
struct kobject * p = kobj; struct kobject * p = kobj;
int length = 1; int length = 1;
do { do {
length += strlen(p->name) + 1; length += strlen(kobject_name(p)) + 1;
p = p->parent; p = p->parent;
} while (p); } while (p);
return length; return length;
...@@ -54,11 +54,11 @@ static void fill_object_path(struct kobject * kobj, char * buffer, int length) ...@@ -54,11 +54,11 @@ static void fill_object_path(struct kobject * kobj, char * buffer, int length)
--length; --length;
for (p = kobj; p; p = p->parent) { for (p = kobj; p; p = p->parent) {
int cur = strlen(p->name); int cur = strlen(kobject_name(p));
/* back up enough to print this bus id with '/' */ /* back up enough to print this bus id with '/' */
length -= cur; length -= cur;
strncpy(buffer + length,p->name,cur); strncpy(buffer + length,kobject_name(p),cur);
*(buffer + --length) = '/'; *(buffer + --length) = '/';
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment