lkml.org 
[lkml]   [2009]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH 2/3] kobject : make kset_create check kobject_set_name return value
From
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>
---
lib/kobject.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff -uprN linux.old/lib/kobject.c linux.new/lib/kobject.c
--- linux.old/lib/kobject.c 2009-05-11 13:59:01.000000000 +0800
+++ linux.new/lib/kobject.c 2009-05-11 14:00:39.000000000 +0800
@@ -793,11 +793,16 @@ static struct kset *kset_create(const ch
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;

\
 
 \ /
  Last update: 2009-05-11 08:21    [W:0.027 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site