lkml.org 
[lkml]   [2004]   [Apr]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] Driver Core fixes for 2.6.6-rc2
Date
From
ChangeSet 1.1929, 2004/04/22 15:11:12-07:00, lxiep@us.ibm.com

[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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.044 / U:0.272 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site