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>] [day] [month] [year] [list]
Message-Id: <20221013040551.277251-1-zeming@nfschina.com>
Date:   Thu, 13 Oct 2022 12:05:51 +0800
From:   Li zeming <zeming@...china.com>
To:     hubcap@...ibond.com, martin@...ibond.com
Cc:     devel@...ts.orangefs.org, linux-kernel@...r.kernel.org,
        Li zeming <zeming@...china.com>
Subject: [PATCH] orangefs: inode: Optimized variable usage in orangefs_* correlation functions

These functions are optimized as follows.
1. Remove some variables to initialize the assignment, they are assigned
first.
2. Removes the cast part of a variable assignment of type void*.
3. The orangefs_inode variable is directly assigned at the definition.

Signed-off-by: Li zeming <zeming@...china.com>
---
 fs/orangefs/inode.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c
index 7a8c0c6e698d..ea557b3b989e 100644
--- a/fs/orangefs/inode.c
+++ b/fs/orangefs/inode.c
@@ -719,7 +719,7 @@ static int orangefs_setattr_size(struct inode *inode, struct iattr *iattr)
 	struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
 	struct orangefs_kernel_op_s *new_op;
 	loff_t orig_size;
-	int ret = -EINVAL;
+	int ret;
 
 	gossip_debug(GOSSIP_INODE_DEBUG,
 		     "%s: %pU: Handle is %pU | fs_id %d | size is %llu\n",
@@ -1021,7 +1021,7 @@ static inline ino_t orangefs_handle_hash(struct orangefs_object_kref *ref)
  */
 static int orangefs_set_inode(struct inode *inode, void *data)
 {
-	struct orangefs_object_kref *ref = (struct orangefs_object_kref *) data;
+	struct orangefs_object_kref *ref = data;
 	ORANGEFS_I(inode)->refn.fs_id = ref->fs_id;
 	ORANGEFS_I(inode)->refn.khandle = ref->khandle;
 	ORANGEFS_I(inode)->attr_valid = 0;
@@ -1036,10 +1036,9 @@ static int orangefs_set_inode(struct inode *inode, void *data)
  */
 static int orangefs_test_inode(struct inode *inode, void *data)
 {
-	struct orangefs_object_kref *ref = (struct orangefs_object_kref *) data;
-	struct orangefs_inode_s *orangefs_inode = NULL;
+	struct orangefs_object_kref *ref = data;
+	struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
 
-	orangefs_inode = ORANGEFS_I(inode);
 	/* test handles and fs_ids... */
 	return (!ORANGEFS_khandle_cmp(&(orangefs_inode->refn.khandle),
 				&(ref->khandle)) &&
@@ -1056,7 +1055,7 @@ static int orangefs_test_inode(struct inode *inode, void *data)
 struct inode *orangefs_iget(struct super_block *sb,
 		struct orangefs_object_kref *ref)
 {
-	struct inode *inode = NULL;
+	struct inode *inode;
 	unsigned long hash;
 	int error;
 
-- 
2.18.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ