Re: [PATCH] Driver Core fixes for 2.6.6-rc2
From: Greg KH
Date: Thu Apr 22 2004 - 17:36:56 EST
ChangeSet 1.1929, 2004/04/22 15:11:12-07:00, lxiep@xxxxxxxxxx
[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.
fs/sysfs/symlink.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff -Nru a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c
--- a/fs/sysfs/symlink.c Thu Apr 22 15:27:07 2004
+++ b/fs/sysfs/symlink.c Thu Apr 22 15:27:07 2004
@@ -42,7 +42,7 @@
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;
@@ -54,11 +54,11 @@
--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) = '/';
}
}
-
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/