diff options
author | Mike Marshall <hubcap@omnibond.com> | 2015-07-29 13:36:37 -0400 |
---|---|---|
committer | Mike Marshall <hubcap@omnibond.com> | 2015-10-03 11:40:03 -0400 |
commit | eeaa3d448c5d35ad0dc16a981aacd64139c53eee (patch) | |
tree | 113bc05b053812e48a281bfb015b25958fa697e6 /fs/orangefs/pvfs2-utils.c | |
parent | 84d02150dea7571dc32176e35d65eecde82631a9 (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/pvfs2-utils.c')
-rw-r--r-- | fs/orangefs/pvfs2-utils.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/orangefs/pvfs2-utils.c b/fs/orangefs/pvfs2-utils.c index 107f425d2e90..8d4411ca118f 100644 --- a/fs/orangefs/pvfs2-utils.c +++ b/fs/orangefs/pvfs2-utils.c @@ -1077,6 +1077,7 @@ void debug_string_to_mask(char *debug_string, void *mask, int type) char *unchecked_keyword; int i; char *strsep_fodder = kstrdup(debug_string, GFP_KERNEL); + char *original_pointer; int element_count = 0; struct client_debug_mask *c_mask; __u64 *k_mask; @@ -1092,6 +1093,7 @@ void debug_string_to_mask(char *debug_string, void *mask, int type) element_count = num_kmod_keyword_mask_map; } + original_pointer = strsep_fodder; while ((unchecked_keyword = strsep(&strsep_fodder, ","))) if (strlen(unchecked_keyword)) { for (i = 0; i < element_count; i++) @@ -1105,7 +1107,7 @@ void debug_string_to_mask(char *debug_string, void *mask, int type) &k_mask); } - kfree(strsep_fodder); + kfree(original_pointer); } void do_c_mask(int i, |