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.
struct kobject * p = kobj;
int length = 1;
do {
- length += strlen(p->name) + 1;
+ length += strlen(kobject_name(p)) + 1;
p = p->parent;
} while (p);
return length;
--length;
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 '/' */
length -= cur;
- strncpy(buffer + length,p->name,cur);
+ strncpy(buffer + length,kobject_name(p),cur);
*(buffer + --length) = '/';
}
}