Skip to content

Commit

Permalink
kobject: make kset_create check kobject_set_name return value
Browse files Browse the repository at this point in the history
kset_create should check the kobject_set_name return value.

Add the return value checking code.

Signed-off-by: Dave Young <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
hidave authored and gregkh committed Jun 16, 2009
1 parent 59a3cd7 commit d9cd8f3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/kobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit d9cd8f3

Please sign in to comment.