Messages in this thread Patch in this message | | | Subject | Re: [PATCH] Driver Core update for 2.6.6-rc1 | Date | Thu, 15 Apr 2004 10:41:52 -0700 | From | Greg KH <> |
| |
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; - 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/
| |