lkml.org 
[lkml]   [2004]   [Apr]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] Driver Core update for 2.6.6-rc1
Date
From
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/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.034 / U:2.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site