ChangeSet 1.1643.36.11, 2004/03/31 15:20:20-08:00, lxiep@ltcfwd.linux.ibm.com [PATCH] kobject_set_name() doesn't allocate enough space lib/kobject.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff -Nru a/lib/kobject.c b/lib/kobject.c --- a/lib/kobject.c Thu Apr 15 10:20:40 2004 +++ b/lib/kobject.c Thu Apr 15 10:20:40 2004 @@ -349,16 +349,16 @@ /* * 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. */ - if (need > limit) { + if (need >= limit) { kfree(name); error = -EFAULT; goto Done;