summary refs log tree commit diff
path: root/fs/orangefs/xattr.c
diff options
context:
space:
mode:
authorMike Marshall <hubcap@omnibond.com>2015-07-29 13:36:37 -0400
committerMike Marshall <hubcap@omnibond.com>2015-10-03 11:40:03 -0400
commiteeaa3d448c5d35ad0dc16a981aacd64139c53eee (patch)
tree113bc05b053812e48a281bfb015b25958fa697e6 /fs/orangefs/xattr.c
parent84d02150dea7571dc32176e35d65eecde82631a9 (diff)
downloadlinux-eeaa3d448c5d35ad0dc16a981aacd64139c53eee.tar.gz
Orangefs: address problems found by static checker
  Don't check for negative rc from boolean.

  Don't pointlessly initialize variables, it short-circuits
  gcc's uninitialized variable warnings. And max_new_nr_segs
  can never be zero, so don't check for it.

  Preserve original kstrdup pointer for freeing later.

  Don't check for negative value in unsigned variable.

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Diffstat (limited to 'fs/orangefs/xattr.c')
-rw-r--r--fs/orangefs/xattr.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/orangefs/xattr.c b/fs/orangefs/xattr.c
index 2766090f5ca4..227eaa47b1e1 100644
--- a/fs/orangefs/xattr.c
+++ b/fs/orangefs/xattr.c
@@ -77,10 +77,8 @@ ssize_t pvfs2_inode_getxattr(struct inode *inode, const char *prefix,
 		gossip_err("pvfs2_inode_getxattr: bogus NULL pointers\n");
 		return -EINVAL;
 	}
-	if (size < 0 ||
-	    (strlen(name) + strlen(prefix)) >= PVFS_MAX_XATTR_NAMELEN) {
-		gossip_err("Invalid size (%d) or key length (%d)\n",
-			   (int)size,
+	if ((strlen(name) + strlen(prefix)) >= PVFS_MAX_XATTR_NAMELEN) {
+		gossip_err("Invalid key length (%d)\n",
 			   (int)(strlen(name) + strlen(prefix)));
 		return -EINVAL;
 	}