From: Linda Xie <lxiep@us.ibm.com>
To: linux-kernel@vger.kernel.org, Greg KH <gregkh@us.ibm.com>
Cc: scheel@us.ibm.com, wortman@us.ibm.com
Subject: PATCH -- kobject_set_name() doesn't allocate enough space
Date: Tue, 16 Dec 2003 14:15:41 -0600 [thread overview]
Message-ID: <3FDF67ED.1070605@us.ltcfwd.linux.ibm.com> (raw)
Hi All,
The sapce allocated in kobject_set_name() is 1 byte less than it should
be. The Attached patch fixes this bug.
Comments are welcome.
Thanks,
Linda Xie
IBM Linux Technology Center
diff -Nru a/lib/kobject.c b/lib/kobject.c
--- a/lib/kobject.c Sun Dec 14 21:19:29 2003
+++ b/lib/kobject.c Sun Dec 14 21:19:29 2003
@@ -344,12 +344,12 @@
/*
* 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. */
next reply other threads:[~2003-12-16 20:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-16 20:15 Linda Xie [this message]
2003-12-16 20:44 ` PATCH -- kobject_set_name() doesn't allocate enough space Linus Torvalds
2003-12-16 23:24 ` Linda Xie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3FDF67ED.1070605@us.ltcfwd.linux.ibm.com \
--to=lxiep@us.ibm.com \
--cc=gregkh@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=scheel@us.ibm.com \
--cc=wortman@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.