mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/3] kobject : make kset_create check kobject_set_name return  value
@ 2009-05-11  6:17 Dave Young
  0 siblings, 0 replies; only message in thread
From: Dave Young @ 2009-05-11  6:17 UTC (permalink / raw)
  To: Greg KH, Linux Kernel Mailing List

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-05-11  6:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-11  6:17 [PATCH 2/3] kobject : make kset_create check kobject_set_name return value Dave Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®