[<prev] [next>] [day] [month] [year] [list]
Message-ID: <a8e1da0905102317n1be27da2lc9fd4dc1265b12ce@mail.gmail.com>
Date: Mon, 11 May 2009 14:17:45 +0800
From: Dave Young <hidave.darkstar@...il.com>
To: Greg KH <gregkh@...e.de>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/3] 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@...il.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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists