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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 2 Jan 2007 13:41:10 +0100
From:	Mariusz Kozlowski <m.kozlowski@...land.pl>
To:	gregkh@...e.de
Cc:	linux-kernel@...r.kernel.org
Subject: [patch] fs: sysfs kobject_put cleanup

Hello,

	This patch removes redundant argument checks for kobject_put().

Signed-off-by: Mariusz Kozlowski <m.kozlowski@...land.pl>

 fs/sysfs/bin.c  |    5 ++---
 fs/sysfs/file.c |    5 ++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff -upr linux-2.6.20-rc2-mm1-a/fs/sysfs/bin.c linux-2.6.20-rc2-mm1-b/fs/sysfs/bin.c
--- linux-2.6.20-rc2-mm1-a/fs/sysfs/bin.c	2006-12-24 05:00:32.000000000 +0100
+++ linux-2.6.20-rc2-mm1-b/fs/sysfs/bin.c	2007-01-02 02:34:32.000000000 +0100
@@ -146,7 +146,7 @@ static int open(struct inode * inode, st
  Error:
 	module_put(attr->attr.owner);
  Done:
-	if (error && kobj)
+	if (error)
 		kobject_put(kobj);
 	return error;
 }
@@ -157,8 +157,7 @@ static int release(struct inode * inode,
 	struct bin_attribute * attr = to_bin_attr(file->f_path.dentry);
 	u8 * buffer = file->private_data;
 
-	if (kobj) 
-		kobject_put(kobj);
+	kobject_put(kobj);
 	module_put(attr->attr.owner);
 	kfree(buffer);
 	return 0;
diff -upr linux-2.6.20-rc2-mm1-a/fs/sysfs/file.c linux-2.6.20-rc2-mm1-b/fs/sysfs/file.c
--- linux-2.6.20-rc2-mm1-a/fs/sysfs/file.c	2006-12-28 12:57:48.000000000 +0100
+++ linux-2.6.20-rc2-mm1-b/fs/sysfs/file.c	2007-01-02 02:34:03.000000000 +0100
@@ -375,7 +375,7 @@ static int sysfs_open_file(struct inode 
 	error = -EACCES;
 	module_put(attr->owner);
  Done:
-	if (error && kobj)
+	if (error)
 		kobject_put(kobj);
 	return error;
 }
@@ -389,8 +389,7 @@ static int sysfs_release(struct inode * 
 
 	if (buffer)
 		remove_from_collection(buffer, inode);
-	if (kobj) 
-		kobject_put(kobj);
+	kobject_put(kobj);
 	/* After this point, attr should not be accessed. */
 	module_put(owner);
 


-- 
Regards,

	Mariusz Kozlowski
-
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