diff mbox

[17/17,V3] btrfs-progs: initialize save_ptr prior to strtok_r

Message ID 512D2E1E.40102@redhat.com (mailing list archive)
State Under Review, archived
Headers show

Commit Message

Eric Sandeen Feb. 26, 2013, 9:50 p.m. UTC
The coverity runs had a false positive complaining that
save_ptr is uninitialized in the call to strtok_r.

Turns out that under the covers glibc was doing enough
to confuse the checker about what was being called.

Just to keep the noise down, do a harmless initialization,
with a comment as to why.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---

V3: Keep strtok_r for old compat, and just init the var.



--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/cmds-balance.c b/cmds-balance.c
index b671e1d..f5dc317 100644
--- a/cmds-balance.c
+++ b/cmds-balance.c
@@ -67,7 +67,7 @@  static int parse_one_profile(const char *profile, u64 *flags)
 static int parse_profiles(char *profiles, u64 *flags)
 {
 	char *this_char;
-	char *save_ptr;
+	char *save_ptr = NULL; /* Satisfy static checkers */
 
 	for (this_char = strtok_r(profiles, "|", &save_ptr);
 	     this_char != NULL;
@@ -136,7 +136,7 @@  static int parse_filters(char *filters, struct btrfs_balance_args *args)
 {
 	char *this_char;
 	char *value;
-	char *save_ptr;
+	char *save_ptr = NULL; /* Satisfy static checkers */
 
 	if (!filters)
 		return 0;