diff -Nru a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c --- a/drivers/pci/hotplug/pci_hotplug_core.c Sun Dec 14 21:19:29 2003 +++ b/drivers/pci/hotplug/pci_hotplug_core.c Sun Dec 14 21:19:29 2003 @@ -533,7 +533,7 @@ if ((slot->info == NULL) || (slot->ops == NULL)) return -EINVAL; - strlcpy(slot->kobj.name, slot->name, KOBJ_NAME_LEN); + kobject_set_name(&slot->kobj, slot->name); kobj_set_kset_s(slot, pci_hotplug_slots_subsys); /* this can fail if we have already registered a slot with the same name */ diff -Nru a/fs/sysfs/symlink.c b/fs/sysfs/symlink.c --- a/fs/sysfs/symlink.c Sun Dec 14 21:19:29 2003 +++ b/fs/sysfs/symlink.c Sun Dec 14 21:19:29 2003 @@ -42,7 +42,10 @@ struct kobject * p = kobj; int length = 1; do { - length += strlen(p->name) + 1; + if (p->k_name) + length += strlen(p->k_name) + 1; + else + length += strlen(p->name) + 1; p = p->parent; } while (p); return length; @@ -54,11 +57,20 @@ --length; for (p = kobj; p; p = p->parent) { - int cur = strlen(p->name); - + int cur; + char *name; + + if (p->k_name) { + cur = strlen(p->k_name); + name = p->k_name; + } + else { + cur = strlen(p->name); + name = p->name; + } /* back up enough to print this bus id with '/' */ length -= cur; - strncpy(buffer + length,p->name,cur); + strncpy(buffer + length,name,cur); *(buffer + --length) = '/'; } } diff -Nru a/lib/kobject.c b/lib/kobject.c --- a/lib/kobject.c Sun Dec 14 21:19:29 2003 +++ b/lib/kobject.c Sun Dec 14 21:19:29 2003 @@ -344,12 +344,12 @@ /* * Need more space? Allocate it and try again */ - name = kmalloc(need,GFP_KERNEL); + limit = need + 1; + name = kmalloc(limit,GFP_KERNEL); if (!name) { error = -ENOMEM; goto Done; } - limit = need; need = vsnprintf(name,limit,fmt,args); /* Still? Give up. */