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>
diff --git a/fs/orangefs/pvfs2-utils.c b/fs/orangefs/pvfs2-utils.c
index 107f425..8d4411c 100644
--- a/fs/orangefs/pvfs2-utils.c
+++ b/fs/orangefs/pvfs2-utils.c
@@ -1077,6 +1077,7 @@
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 @@
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 @@
&k_mask);
}
- kfree(strsep_fodder);
+ kfree(original_pointer);
}
void do_c_mask(int i,