From 63088d8225df025e03a0ea0a0d8fdc3e8e9b9b08 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Fri, 28 Dec 2018 09:56:20 +0530 Subject: multiple-files: clang-scan fixes updates: bz#1622665 Change-Id: I9f3a75ed9be3d90f37843a140563c356830ef945 Signed-off-by: Amar Tumballi --- libglusterfs/src/run.c | 6 +++--- xlators/features/bit-rot/src/bitd/bit-rot-scrub.c | 4 ++++ xlators/features/quota/src/quotad-aggregator.c | 3 +++ xlators/mount/fuse/src/fuse-bridge.c | 15 ++++++++++++--- xlators/performance/io-threads/src/io-threads.c | 2 +- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/libglusterfs/src/run.c b/libglusterfs/src/run.c index f32c17d9d4b..58f95a7e610 100644 --- a/libglusterfs/src/run.c +++ b/libglusterfs/src/run.c @@ -132,7 +132,7 @@ runner_insert_arg(runner_t *runner, char *arg) GF_ASSERT(arg); - if (runner->runerr) + if (runner->runerr || !runner->argv) return; for (i = 0; i < runner->argvlen; i++) { @@ -263,8 +263,8 @@ runner_start(runner_t *runner) int i = 0; sigset_t set; - if (runner->runerr) { - errno = runner->runerr; + if (runner->runerr || !runner->argv) { + errno = (runner->runerr) ? runner->runerr : EINVAL; return -1; } diff --git a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c index 2e20e1f9572..35318dcfa4e 100644 --- a/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c +++ b/xlators/features/bit-rot/src/bitd/bit-rot-scrub.c @@ -1545,9 +1545,11 @@ br_scrubber_log_option(xlator_t *this, br_private_t *priv, [BR_SCRUB_THROTTLE_LAZY] = "lazy", [BR_SCRUB_THROTTLE_NORMAL] = "normal", [BR_SCRUB_THROTTLE_AGGRESSIVE] = "aggressive", + [BR_SCRUB_THROTTLE_STALLED] = "stalled", }; char *scrub_freq_str[] = { + [0] = "", [BR_FSSCRUB_FREQ_HOURLY] = "hourly", [BR_FSSCRUB_FREQ_DAILY] = "daily", [BR_FSSCRUB_FREQ_WEEKLY] = "weekly", @@ -1560,6 +1562,8 @@ br_scrubber_log_option(xlator_t *this, br_private_t *priv, return; /* logged as pause */ if (fsscrub->frequency_reconf || fsscrub->throttle_reconf) { + if (fsscrub->throttle == BR_SCRUB_THROTTLE_VOID) + return; gf_msg(this->name, GF_LOG_INFO, 0, BRB_MSG_SCRUB_TUNABLE, "SCRUB TUNABLES:: [Frequency: %s, Throttle: %s]", scrub_freq_str[fsscrub->frequency], diff --git a/xlators/features/quota/src/quotad-aggregator.c b/xlators/features/quota/src/quotad-aggregator.c index e0129e4f63a..3b883d3f7e0 100644 --- a/xlators/features/quota/src/quotad-aggregator.c +++ b/xlators/features/quota/src/quotad-aggregator.c @@ -132,6 +132,9 @@ quotad_aggregator_getlimit_cbk(xlator_t *this, call_frame_t *frame, int ret = -1; int type = 0; + if (!rsp || (rsp->op_ret == -1)) + goto reply; + GF_PROTOCOL_DICT_UNSERIALIZE(frame->this, xdata, (rsp->xdata.xdata_val), (rsp->xdata.xdata_len), rsp->op_ret, rsp->op_errno, out); diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index a5135df30ac..d81db2e8c75 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -2339,7 +2339,9 @@ fuse_rename_cbk(call_frame_t *frame, void *cookie, xlator_t *this, state->loc2.parent ? uuid_utoa(state->loc2.parent->gfid) : "", state->loc.inode ? uuid_utoa(state->loc.inode->gfid) : ""); - if (op_ret == 0) { + /* need to check for loc->parent to keep clang-scan happy. + It gets dereferenced below, and is checked for NULL above. */ + if ((op_ret == 0) && (state->loc.parent) && (state->loc.inode)) { gf_log("glusterfs-fuse", GF_LOG_TRACE, "%" PRIu64 ": %s -> %s => 0 (buf->ia_ino=%" PRIu64 ")", frame->root->unique, state->loc.path, state->loc2.path, @@ -3261,6 +3263,9 @@ fuse_release(xlator_t *this, fuse_in_header_t *finh, void *msg, GET_STATE(this, finh, state); fd = FH_TO_FD(fri->fh); + if (!fd) + goto out; + state->fd = fd; priv = this->private; @@ -3274,10 +3279,11 @@ fuse_release(xlator_t *this, fuse_in_header_t *finh, void *msg, fuse_fd_ctx_destroy(this, state->fd); fd_unref(fd); - state->fd = NULL; - gf_fdptr_put(priv->fdtable, fd); + state->fd = NULL; + +out: send_fuse_err(this, finh, 0); free_fuse_state(state); @@ -3748,6 +3754,8 @@ fuse_releasedir(xlator_t *this, fuse_in_header_t *finh, void *msg, GET_STATE(this, finh, state); state->fd = FH_TO_FD(fri->fh); + if (!state->fd) + goto out; priv = this->private; @@ -3764,6 +3772,7 @@ fuse_releasedir(xlator_t *this, fuse_in_header_t *finh, void *msg, state->fd = NULL; +out: send_fuse_err(this, finh, 0); free_fuse_state(state); diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index 3449718c2d4..411888424ed 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -612,7 +612,7 @@ iot_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name, conf = this->private; - if (conf && name && strcmp(name, IO_THREADS_QUEUE_SIZE_KEY) == 0) { + if (name && strcmp(name, IO_THREADS_QUEUE_SIZE_KEY) == 0) { /* * We explicitly do not want a reference count * for this dict in this translator -- cgit