summaryrefslogtreecommitdiff
path: root/fs/orangefs/file.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/file.c
parent84d02150dea7571dc32176e35d65eecde82631a9 (diff)
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/file.c')
-rw-r--r--fs/orangefs/file.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
index 4ba1b6c48aa7..013a07c8bdfd 100644
--- a/fs/orangefs/file.c
+++ b/fs/orangefs/file.c
@@ -463,12 +463,12 @@ static ssize_t do_readv_writev(enum PVFS_io_type type, struct file *file,
unsigned int to_free;
size_t count;
unsigned long seg;
- unsigned long new_nr_segs = 0;
- unsigned long max_new_nr_segs = 0;
- unsigned long seg_count = 0;
- unsigned long *seg_array = NULL;
- struct iovec *iovecptr = NULL;
- struct iovec *ptr = NULL;
+ unsigned long new_nr_segs;
+ unsigned long max_new_nr_segs;
+ unsigned long seg_count;
+ unsigned long *seg_array;
+ struct iovec *iovecptr;
+ struct iovec *ptr;
total_count = 0;
ret = -EINVAL;
@@ -477,12 +477,6 @@ static ssize_t do_readv_writev(enum PVFS_io_type type, struct file *file,
/* Compute total and max number of segments after split */
max_new_nr_segs = bound_max_iovecs(iov, nr_segs, &count);
- if (max_new_nr_segs < 0) {
- gossip_lerr("%s: could not bound iovec %lu\n",
- __func__,
- max_new_nr_segs);
- goto out;
- }
gossip_debug(GOSSIP_FILE_DEBUG,
"%s-BEGIN(%pU): count(%d) after estimate_max_iovecs.\n",