summaryrefslogtreecommitdiff
path: root/lib/kobject.c
diff options
context:
space:
mode:
authorDave Young <hidave.darkstar@gmail.com>2009-05-11 14:17:45 +0800
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-15 21:30:24 -0700
commitd9cd8f37855b012757818f31390e8f84db251c89 (patch)
tree4785d05f5df93747b6aa3386c98784d441d61377 /lib/kobject.c
parent59a3cd7f9da60ac4ba8ae5a4cddc48fe4a450129 (diff)
kobject: make kset_create check kobject_set_name return value
kset_create should check the kobject_set_name return value. Add the return value checking code. Signed-off-by: Dave Young <hidave.darkstar@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'lib/kobject.c')
-rw-r--r--lib/kobject.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/kobject.c b/lib/kobject.c
index bacf6fe4f7a..b512b746d2a 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -793,11 +793,16 @@ static struct kset *kset_create(const char *name,
struct kobject *parent_kobj)
{
struct kset *kset;
+ int retval;
kset = kzalloc(sizeof(*kset), GFP_KERNEL);
if (!kset)
return NULL;
- kobject_set_name(&kset->kobj, name);
+ retval = kobject_set_name(&kset->kobj, name);
+ if (retval) {
+ kfree(kset);
+ return NULL;
+ }
kset->uevent_ops = uevent_ops;
kset->kobj.parent = parent_kobj;