diff options
| author | Linda Xie <lxiep@ltcfwd.linux.ibm.com> | 2004-03-30 23:20:20 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <greg@kroah.com> | 2004-03-30 23:20:20 -0800 |
| commit | cdf1a041e82818823d0a819c54adc851a779953b (patch) | |
| tree | 7ef746572e7a89b231613bc094243d227de20338 /lib/kobject.c | |
| parent | 100a165dcdc71cb06b8d55c6910573cc4493e26e (diff) | |
[PATCH] kobject_set_name() doesn't allocate enough space
Diffstat (limited to 'lib/kobject.c')
| -rw-r--r-- | lib/kobject.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/kobject.c b/lib/kobject.c index 2430e2be81e3..5e8d1ed70716 100644 --- a/lib/kobject.c +++ b/lib/kobject.c @@ -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; |
