public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Driver Core update for 2.6.6-rc1
Date: Thu, 15 Apr 2004 10:41:52 -0700	[thread overview]
Message-ID: <10820509124057@kroah.com> (raw)
In-Reply-To: <10820509122685@kroah.com>

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;


  reply	other threads:[~2004-04-15 17:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-15 17:35 [BK PATCH] Driver Core update for 2.6.6-rc1 Greg KH
2004-04-15 17:41 ` [PATCH] " Greg KH
2004-04-15 17:41   ` Greg KH
2004-04-15 17:41     ` Greg KH
2004-04-15 17:41       ` Greg KH
2004-04-15 17:41         ` Greg KH
2004-04-15 17:41           ` Greg KH
2004-04-15 17:41             ` Greg KH
2004-04-15 17:41               ` Greg KH
2004-04-15 17:41                 ` Greg KH
2004-04-15 17:41                   ` Greg KH
2004-04-15 17:41                     ` Greg KH [this message]
2004-04-15 17:41                       ` Greg KH
2004-04-15 17:41                         ` Greg KH
2004-04-15 17:41                           ` Greg KH
2004-04-15 17:41                             ` Greg KH
2004-04-15 17:41                               ` Greg KH
2004-04-15 17:41                                 ` Greg KH
2004-04-15 17:41                                   ` Greg KH

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=10820509124057@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox