aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-11-18 16:47:13 -0800
committerGreg Kroah-Hartman <greg@kroah.com>2004-11-18 16:47:13 -0800
commit0e8a2de644a93132594f66222a9d48405674eacd (patch)
tree6ff57816d1ea2f30ca8d9ffd56474c9cbac550a8 /lib
parent84ac4d4ad11ba4e6d60301247a40b45e52793ccb (diff)
downloadhistory-0e8a2de644a93132594f66222a9d48405674eacd.tar.gz
[PATCH] fix kobject varargs bug
From: Gerd Knorr <kraxel@bytesex.org> It uses the varargs list twice in a illegal way. That doesn't harm on i386 by pure luck, but blows things up on amd64 machines. Using var args list twice without calling va_start twice is illegal. Signed-off-by: Gerd Knorr <kraxel@bytesex.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/kobject.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index 6fa0799eb65fbe..8737dfd72d3607 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -232,11 +232,12 @@ int kobject_set_name(struct kobject * kobj, const char * fmt, ...)
va_list args;
char * name;
- va_start(args,fmt);
/*
* First, try the static array
*/
+ va_start(args,fmt);
need = vsnprintf(kobj->name,limit,fmt,args);
+ va_end(args);
if (need < limit)
name = kobj->name;
else {
@@ -249,7 +250,9 @@ int kobject_set_name(struct kobject * kobj, const char * fmt, ...)
error = -ENOMEM;
goto Done;
}
+ va_start(args,fmt);
need = vsnprintf(name,limit,fmt,args);
+ va_end(args);
/* Still? Give up. */
if (need >= limit) {
@@ -266,7 +269,6 @@ int kobject_set_name(struct kobject * kobj, const char * fmt, ...)
/* Now, set the new name */
kobj->k_name = name;
Done:
- va_end(args);
return error;
}