lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <4851E4DC.6040603@cn.fujitsu.com>
Date:	Fri, 13 Jun 2008 11:09:16 +0800
From:	Li Zefan <lizf@...fujitsu.com>
To:	Greg KH <gregkh@...e.de>, LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] kobject: should use kobject_put() in kset-example

We should call kobject_put() instead of kfree() if kobject_init_and_add()
returns an error, shouldn't we? Don't set up a bad example ;)

Signed-off-by: Li Zefan <lizf@...fujitsu.com>
---
 samples/kobject/kset-example.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/samples/kobject/kset-example.c b/samples/kobject/kset-example.c
index b0a1b4f..7395c0b 100644
--- a/samples/kobject/kset-example.c
+++ b/samples/kobject/kset-example.c
@@ -211,7 +211,7 @@ static struct foo_obj *create_foo_obj(const char *name)
 	 */
 	retval = kobject_init_and_add(&foo->kobj, &foo_ktype, NULL, "%s", name);
 	if (retval) {
-		kfree(foo);
+		kobject_put(&foo->kobj);
 		return NULL;
 	}
 
-- 
1.5.4.rc3
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ