summaryrefslogtreecommitdiffstats
path: root/glusterfsd
diff options
context:
space:
mode:
authorShyamsundarR <srangana@redhat.com>2018-08-21 21:53:35 -0400
committerAmar Tumballi <amarts@redhat.com>2018-08-22 18:13:12 +0000
commitfaf736cb3043ade5b2ad3267c45d2ba0bce53b52 (patch)
treee787f7c8aeebe47ad4834ca21feedfcb55bf797f /glusterfsd
parent37cb48e5919a2eac2525245ce7a8185e17f514f2 (diff)
coverity: Multiple coverity fixes for issues with HIGH severity
glfs-fops.c 1391414 Uninitialized pointer read List head needed initialization glusterfsd-mgmt.c graph.c 1382431 Buffer not null terminated 1382417 Dereference before null check 1382347 Buffer not null terminated Cleaned usage of volfile_checksum member of gf_volfile_t struct across the code base. glusterd-tier.c 1382426 Resource leak 1370955 Dereference before null check The function fixed needs more work, but with tier almost being deprecated, addressed some parts of the reported coverity issues as appropriate. Tested using the following test cases: ./tests/basic/tier/new-tier-cmds.t ./tests/basic/tier/tier.t ./tests/basic/tier/bug-1214222-directories_missing_after_attach_tier.t ./tests/basic/tier/tier_lookup_heal.t ./tests/basic/tier/tier-heald.t ./tests/basic/tier/tier-snapshot.t ./tests/features/glfs-lease.t Change-Id: I396f1c34bb112bb22d2745ed279e1a4850cac4af Updates: bz#789278 Signed-off-by: ShyamsundarR <srangana@redhat.com>
Diffstat (limited to 'glusterfsd')
-rw-r--r--glusterfsd/src/glusterfsd-mgmt.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
index df9a05c75f0..3228c27c6aa 100644
--- a/glusterfsd/src/glusterfsd-mgmt.c
+++ b/glusterfsd/src/glusterfsd-mgmt.c
@@ -1979,7 +1979,7 @@ volfile:
list_for_each_entry (volfile_obj, &ctx->volfile_list,
volfile_list) {
if (!strcmp (volfile_id, volfile_obj->vol_id)) {
- if (!strncmp (sha256_hash,
+ if (!memcmp (sha256_hash,
volfile_obj->volfile_checksum,
sizeof (volfile_obj->volfile_checksum))) {
gf_log (frame->this->name, GF_LOG_INFO,
@@ -2047,8 +2047,8 @@ volfile:
"checksum.");
goto out;
}
- strncpy (volfile_tmp->volfile_checksum, sha256_hash,
- sizeof (volfile_tmp->volfile_checksum));
+ memcpy (volfile_tmp->volfile_checksum, sha256_hash,
+ sizeof (volfile_tmp->volfile_checksum));
goto out;
}
@@ -2080,8 +2080,8 @@ volfile:
sizeof (volfile_tmp->vol_id), "%s",
volfile_id);
}
- strncpy (volfile_tmp->volfile_checksum, sha256_hash,
- sizeof (volfile_tmp->volfile_checksum));
+ memcpy (volfile_tmp->volfile_checksum, sha256_hash,
+ sizeof (volfile_tmp->volfile_checksum));
}
UNLOCK (&ctx->volfile_lock);
@@ -2098,11 +2098,9 @@ out:
if (locked)
UNLOCK (&ctx->volfile_lock);
- if (frame) {
- GF_FREE (frame->local);
- frame->local = NULL;
- STACK_DESTROY (frame->root);
- }
+ GF_FREE (frame->local);
+ frame->local = NULL;
+ STACK_DESTROY (frame->root);
free (rsp.spec);