Commit cdf1a041 authored by Linda Xie's avatar Linda Xie Committed by Greg Kroah-Hartman

[PATCH] kobject_set_name() doesn't allocate enough space

parent 100a165d
......@@ -349,16 +349,16 @@ int kobject_set_name(struct kobject * kobj, const char * fmt, ...)
/*
* 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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment