Blob Blame History Raw
From bff03720f92bfcde848f46dca6a2cfad7adaf42e Mon Sep 17 00:00:00 2001
From: Amar Tumballi <amarts@redhat.com>
Date: Tue, 9 Oct 2018 12:32:41 +0530
Subject: [PATCH 399/399] all: fix the format string exceptions

Currently, there are possibilities in few places, where a user-controlled
(like filename, program parameter etc) string can be passed as 'fmt' for
printf(), which can lead to segfault, if the user's string contains '%s',
'%d' in it.

While fixing it, makes sense to make the explicit check for such issues
across the codebase, by making the format call properly.

Fixes: CVE-2018-14661

BUG: 1637084
Change-Id: I63d6b65c61106f77c55f0922dc08a5b8fe421f23
Signed-off-by: Amar Tumballi <amarts@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/152221
Reviewed-by: Xavi Hernandez <xhernandez@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 cli/src/cli-cmd-volume.c                            |  2 +-
 libglusterfs/src/client_t.c                         |  2 +-
 libglusterfs/src/fd.c                               |  4 ++--
 libglusterfs/src/inode.c                            |  2 +-
 libglusterfs/src/iobuf.c                            |  8 ++++----
 libglusterfs/src/latency.c                          |  2 +-
 libglusterfs/src/logging.h                          |  3 ++-
 libglusterfs/src/mem-pool.h                         |  3 ++-
 libglusterfs/src/run.h                              |  3 ++-
 libglusterfs/src/statedump.h                        |  6 ++++--
 xlators/cluster/afr/src/afr-common.c                |  2 +-
 xlators/cluster/ec/src/ec.c                         |  2 +-
 xlators/debug/trace/src/trace.c                     |  2 +-
 xlators/features/barrier/src/barrier.c              |  4 ++--
 xlators/features/gfid-access/src/gfid-access.c      |  2 +-
 xlators/features/locks/src/posix.c                  | 10 +++++-----
 xlators/features/shard/src/shard.c                  |  2 +-
 xlators/mgmt/glusterd/src/glusterd-rebalance.c      |  2 +-
 xlators/mgmt/glusterd/src/glusterd-statedump.c      |  2 +-
 xlators/mount/fuse/src/fuse-bridge.c                |  2 +-
 xlators/performance/io-cache/src/io-cache.c         |  8 ++++----
 xlators/performance/io-threads/src/io-threads.c     |  2 +-
 xlators/performance/md-cache/src/md-cache.c         |  2 +-
 xlators/performance/nl-cache/src/nl-cache-helper.c  |  2 +-
 xlators/performance/nl-cache/src/nl-cache.c         |  2 +-
 xlators/performance/open-behind/src/open-behind.c   |  4 ++--
 xlators/performance/quick-read/src/quick-read.c     |  4 ++--
 xlators/performance/read-ahead/src/read-ahead.c     |  6 +++---
 xlators/performance/write-behind/src/write-behind.c |  6 +++---
 xlators/protocol/client/src/client.c                |  2 +-
 xlators/protocol/server/src/server.c                |  2 +-
 xlators/storage/posix/src/posix.c                   |  2 +-
 32 files changed, 56 insertions(+), 51 deletions(-)

diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c
index 2639afa..a1f0840 100644
--- a/cli/src/cli-cmd-volume.c
+++ b/cli/src/cli-cmd-volume.c
@@ -2846,7 +2846,7 @@ cli_launch_glfs_heal (int heal_op, dict_t *options)
                 runner_add_args (&runner, "source-brick", NULL);
                 runner_argprintf (&runner, "%s:%s", hostname, path);
                 if (dict_get_str (options, "file", &filename) == 0)
-                        runner_argprintf (&runner, filename);
+                        runner_argprintf (&runner, "%s", filename);
                 break;
         case GF_SHD_OP_SPLIT_BRAIN_FILES:
                 runner_add_args (&runner, "split-brain-info", NULL);
diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c
index 17e3026..dce27c1 100644
--- a/libglusterfs/src/client_t.c
+++ b/libglusterfs/src/client_t.c
@@ -650,7 +650,7 @@ clienttable_dump (clienttable_t *clienttable, char *prefix)
                             clienttable->cliententries[i].next_free) {
                                 gf_proc_dump_build_key(key, prefix,
                                                        "cliententry[%d]", i);
-                                gf_proc_dump_add_section(key);
+                                gf_proc_dump_add_section("%s", key);
                                 cliententry_dump(&clienttable->cliententries[i],
                                                  key);
                         }
diff --git a/libglusterfs/src/fd.c b/libglusterfs/src/fd.c
index 2dc52ba..27c8e13 100644
--- a/libglusterfs/src/fd.c
+++ b/libglusterfs/src/fd.c
@@ -1056,7 +1056,7 @@ fd_dump (fd_t *fd, char *prefix)
 
         if (fd->inode) {
                 gf_proc_dump_build_key (key, "inode", NULL);
-                gf_proc_dump_add_section(key);
+                gf_proc_dump_add_section("%s", key);
                 inode_dump (fd->inode, key);
         }
 
@@ -1104,7 +1104,7 @@ fdtable_dump (fdtable_t *fdtable, char *prefix)
                 if (GF_FDENTRY_ALLOCATED ==
                     fdtable->fdentries[i].next_free) {
                         gf_proc_dump_build_key(key, prefix, "fdentry[%d]", i);
-                        gf_proc_dump_add_section(key);
+                        gf_proc_dump_add_section("%s", key);
                         fdentry_dump(&fdtable->fdentries[i], key);
                 }
         }
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
index cf264d8..1bc05a4 100644
--- a/libglusterfs/src/inode.c
+++ b/libglusterfs/src/inode.c
@@ -31,7 +31,7 @@
                 list_for_each_entry (inode, head, list) {               \
                         gf_proc_dump_build_key(key_buf, key_prefix,     \
                                                "%s.%d",list_type, i++); \
-                        gf_proc_dump_add_section(key_buf);              \
+                        gf_proc_dump_add_section("%s", key_buf);        \
                         inode_dump(inode, key);                         \
                 }                                                       \
         }
diff --git a/libglusterfs/src/iobuf.c b/libglusterfs/src/iobuf.c
index 76584fc..f6b8558 100644
--- a/libglusterfs/src/iobuf.c
+++ b/libglusterfs/src/iobuf.c
@@ -1174,7 +1174,7 @@ iobuf_arena_info_dump (struct iobuf_arena *iobuf_arena, const char *key_prefix)
         gf_proc_dump_write(key, "%"PRIu64, iobuf_arena->page_size);
         list_for_each_entry (trav, &iobuf_arena->active.list, list) {
                 gf_proc_dump_build_key(key, key_prefix,"active_iobuf.%d", i++);
-                gf_proc_dump_add_section(key);
+                gf_proc_dump_add_section("%s", key);
                 iobuf_info_dump(trav, key);
         }
 
@@ -1215,21 +1215,21 @@ iobuf_stats_dump (struct iobuf_pool *iobuf_pool)
                 list_for_each_entry (trav, &iobuf_pool->arenas[j], list) {
                         snprintf(msg, sizeof(msg),
                                  "arena.%d", i);
-                        gf_proc_dump_add_section(msg);
+                        gf_proc_dump_add_section("%s", msg);
                         iobuf_arena_info_dump(trav,msg);
                         i++;
                 }
                 list_for_each_entry (trav, &iobuf_pool->purge[j], list) {
                         snprintf(msg, sizeof(msg),
                                  "purge.%d", i);
-                        gf_proc_dump_add_section(msg);
+                        gf_proc_dump_add_section("%s", msg);
                         iobuf_arena_info_dump(trav,msg);
                         i++;
                 }
                 list_for_each_entry (trav, &iobuf_pool->filled[j], list) {
                         snprintf(msg, sizeof(msg),
                                  "filled.%d", i);
-                        gf_proc_dump_add_section(msg);
+                        gf_proc_dump_add_section("%s", msg);
                         iobuf_arena_info_dump(trav,msg);
                         i++;
                 }
diff --git a/libglusterfs/src/latency.c b/libglusterfs/src/latency.c
index 1d75f5b..a890454 100644
--- a/libglusterfs/src/latency.c
+++ b/libglusterfs/src/latency.c
@@ -169,7 +169,7 @@ gf_proc_dump_latency_info (xlator_t *xl)
         int i;
 
         snprintf (key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.latency", xl->name);
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
 
         for (i = 0; i < GF_FOP_MAXVALUE; i++) {
                 gf_proc_dump_build_key (key, key_prefix, "%s",
diff --git a/libglusterfs/src/logging.h b/libglusterfs/src/logging.h
index fd9a36d..4ed2a82 100644
--- a/libglusterfs/src/logging.h
+++ b/libglusterfs/src/logging.h
@@ -172,7 +172,8 @@ int _gf_log_callingfn (const char *domain, const char *file,
                        const char *fmt, ...)
                        __attribute__ ((__format__ (__printf__, 6, 7)));
 
-int _gf_log_eh (const char *function, const char *fmt, ...);
+int _gf_log_eh (const char *function, const char *fmt, ...)
+  __attribute__ ((__format__ (__printf__, 2, 3)));
 
 
 
diff --git a/libglusterfs/src/mem-pool.h b/libglusterfs/src/mem-pool.h
index 1272ad4..dfe1f9a 100644
--- a/libglusterfs/src/mem-pool.h
+++ b/libglusterfs/src/mem-pool.h
@@ -86,7 +86,8 @@ int
 gf_vasprintf (char **string_ptr, const char *format, va_list arg);
 
 int
-gf_asprintf (char **string_ptr, const char *format, ...);
+gf_asprintf (char **string_ptr, const char *format, ...)
+  __attribute__ ((__format__ (__printf__, 2, 3)));
 
 void
 __gf_free (void *ptr);
diff --git a/libglusterfs/src/run.h b/libglusterfs/src/run.h
index 1dc4bf9..e47ce11 100644
--- a/libglusterfs/src/run.h
+++ b/libglusterfs/src/run.h
@@ -76,7 +76,8 @@ void runner_add_args (runner_t *runner, ...);
  * @param runner pointer to runner_t instance
  * @param format printf style format specifier
  */
-void runner_argprintf (runner_t *runner, const char *format, ...);
+void runner_argprintf (runner_t *runner, const char *format, ...)
+  __attribute__ ((__format__ (__printf__, 2, 3)));
 
 /**
  * log a message about the command to be run.
diff --git a/libglusterfs/src/statedump.h b/libglusterfs/src/statedump.h
index 0a7a97e..ee97cdb 100644
--- a/libglusterfs/src/statedump.h
+++ b/libglusterfs/src/statedump.h
@@ -73,9 +73,11 @@ void gf_proc_dump_cleanup(void);
 
 void gf_proc_dump_info(int signum, glusterfs_ctx_t *ctx);
 
-int gf_proc_dump_add_section(char *key,...);
+int gf_proc_dump_add_section(char *key, ...)
+  __attribute__ ((__format__ (__printf__, 1, 2)));
 
-int gf_proc_dump_write(char *key, char *value,...);
+int gf_proc_dump_write(char *key, char *value, ...)
+  __attribute__ ((__format__ (__printf__, 2, 3)));
 
 void inode_table_dump(inode_table_t *itable, char *prefix);
 
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index bded6a2..e8107c9 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -4536,7 +4536,7 @@ afr_priv_dump (xlator_t *this)
 
         GF_ASSERT (priv);
         snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name);
-        gf_proc_dump_add_section(key_prefix);
+        gf_proc_dump_add_section("%s", key_prefix);
         gf_proc_dump_write("child_count", "%u", priv->child_count);
         for (i = 0; i < priv->child_count; i++) {
                 sprintf (key, "child_up[%d]", i);
diff --git a/xlators/cluster/ec/src/ec.c b/xlators/cluster/ec/src/ec.c
index 9a23a45..9cb9580 100644
--- a/xlators/cluster/ec/src/ec.c
+++ b/xlators/cluster/ec/src/ec.c
@@ -1316,7 +1316,7 @@ int32_t ec_dump_private(xlator_t *this)
     GF_ASSERT(ec);
 
     snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name);
-    gf_proc_dump_add_section(key_prefix);
+    gf_proc_dump_add_section("%s", key_prefix);
     gf_proc_dump_write("nodes", "%u", ec->nodes);
     gf_proc_dump_write("redundancy", "%u", ec->redundancy);
     gf_proc_dump_write("fragment_size", "%u", ec->fragment_size);
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index 451ef9a..34ac4ca 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -3059,7 +3059,7 @@ trace_dump_history (xlator_t *this)
         if (conf && conf->log_history == _gf_true) {
                 gf_proc_dump_build_key (key_prefix, "xlator.debug.trace",
                                         "history");
-                gf_proc_dump_add_section (key_prefix);
+                gf_proc_dump_add_section ("%s", key_prefix);
                 eh_dump (this->history, NULL, dump_history_trace);
         }
         ret = 0;
diff --git a/xlators/features/barrier/src/barrier.c b/xlators/features/barrier/src/barrier.c
index ce3a255..8e964e8 100644
--- a/xlators/features/barrier/src/barrier.c
+++ b/xlators/features/barrier/src/barrier.c
@@ -713,7 +713,7 @@ __barrier_dump_queue (barrier_priv_t *priv)
 
         list_for_each_entry (stub, &priv->queue, list) {
                 snprintf (key, sizeof (key), "stub.%d", i++);
-                gf_proc_dump_add_section (key);
+                gf_proc_dump_add_section ("%s", key);
                 barrier_dump_stub(stub, key);
         }
 
@@ -735,7 +735,7 @@ barrier_dump_priv (xlator_t *this)
                 return 0;
 
         gf_proc_dump_build_key (key, "xlator.features.barrier", "priv");
-        gf_proc_dump_add_section (key);
+        gf_proc_dump_add_section ("%s", key);
 
         LOCK (&priv->lock);
         {
diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c
index 7d75b09..aa8aac1 100644
--- a/xlators/features/gfid-access/src/gfid-access.c
+++ b/xlators/features/gfid-access/src/gfid-access.c
@@ -1382,7 +1382,7 @@ ga_dump_inodectx (xlator_t *this, inode_t *inode)
         if (ret == 0) {
                 tmp_inode = (void*) value;
                 gf_proc_dump_build_key (key_prefix, this->name, "inode");
-                gf_proc_dump_add_section (key_prefix);
+                gf_proc_dump_add_section ("%s", key_prefix);
                 gf_proc_dump_write ("real-gfid", "%s",
                                     uuid_utoa (tmp_inode->gfid));
         }
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index c58e6ba..b434a08 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -3292,7 +3292,7 @@ __dump_entrylks (pl_inode_t *pl_inode)
                                           blocked, granted);
                         }
 
-                        gf_proc_dump_write(key, tmp);
+                        gf_proc_dump_write(key, "%s", tmp);
 
                         count++;
                 }
@@ -3313,7 +3313,7 @@ __dump_entrylks (pl_inode_t *pl_inode)
                                   lkowner_utoa (&lock->owner), lock->client,
                                   lock->connection_id, blocked);
 
-                        gf_proc_dump_write(key, tmp);
+                        gf_proc_dump_write(key, "%s", tmp);
 
                         count++;
                 }
@@ -3364,7 +3364,7 @@ __dump_inodelks (pl_inode_t *pl_inode)
                                       &lock->granted_time.tv_sec,
                                       &lock->blkd_time.tv_sec,
                                       _gf_true);
-                        gf_proc_dump_write(key, tmp);
+                        gf_proc_dump_write(key, "%s", tmp);
 
                         count++;
                 }
@@ -3380,7 +3380,7 @@ __dump_inodelks (pl_inode_t *pl_inode)
                                       lock->client, lock->connection_id,
                                       0, &lock->blkd_time.tv_sec,
                                       _gf_false);
-                        gf_proc_dump_write(key, tmp);
+                        gf_proc_dump_write(key, "%s", tmp);
 
                         count++;
                 }
@@ -3421,7 +3421,7 @@ __dump_posixlks (pl_inode_t *pl_inode)
                             &lock->owner, lock->client, NULL,
                             &lock->granted_time.tv_sec, &lock->blkd_time.tv_sec,
                             (lock->blocked)? _gf_false: _gf_true);
-              gf_proc_dump_write(key, tmp);
+              gf_proc_dump_write(key, "%s", tmp);
 
               count++;
         }
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index d67cdf4..f5fb181 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -5557,7 +5557,7 @@ shard_priv_dump (xlator_t *this)
 
         snprintf (key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type,
                   this->name);
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
         gf_proc_dump_write ("shard-block-size", "%s",
                             gf_uint64_2human_readable (priv->block_size));
         gf_proc_dump_write ("inode-count", "%d", priv->inode_count);
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 848e689..5ab828c 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -310,7 +310,7 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
         runner_add_arg (&runner, "--pid-file");
         runner_argprintf (&runner, "%s",pidfile);
         runner_add_arg (&runner, "-l");
-        runner_argprintf (&runner, logfile);
+        runner_argprintf (&runner, "%s", logfile);
         if (volinfo->memory_accounting)
                 runner_add_arg (&runner, "--mem-accounting");
         if (dict_get_str (priv->opts, GLUSTERD_LOCALTIME_LOGGING_KEY,
diff --git a/xlators/mgmt/glusterd/src/glusterd-statedump.c b/xlators/mgmt/glusterd/src/glusterd-statedump.c
index d0a9705..8c2c4b5 100644
--- a/xlators/mgmt/glusterd/src/glusterd-statedump.c
+++ b/xlators/mgmt/glusterd/src/glusterd-statedump.c
@@ -197,7 +197,7 @@ glusterd_dump_priv (xlator_t *this)
                 return 0;
 
         gf_proc_dump_build_key (key, "xlator.glusterd", "priv");
-        gf_proc_dump_add_section (key);
+        gf_proc_dump_add_section ("%s", key);
 
         pthread_mutex_lock (&priv->mutex);
         {
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 85cee73..1c4f4e4 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -5189,7 +5189,7 @@ fuse_history_dump (xlator_t *this)
 
         gf_proc_dump_build_key (key_prefix, "xlator.mount.fuse",
                                 "history");
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
         eh_dump (this->history, NULL, dump_history_fuse);
 
         ret = 0;
diff --git a/xlators/performance/io-cache/src/io-cache.c b/xlators/performance/io-cache/src/io-cache.c
index 8963942..700d8c2 100644
--- a/xlators/performance/io-cache/src/io-cache.c
+++ b/xlators/performance/io-cache/src/io-cache.c
@@ -2008,7 +2008,7 @@ ioc_inode_dump (xlator_t *this, inode_t *inode)
                 if (gf_uuid_is_null (ioc_inode->inode->gfid))
                         goto unlock;
 
-                gf_proc_dump_add_section (key_prefix);
+                gf_proc_dump_add_section ("%s", key_prefix);
                 section_added = _gf_true;
 
                 __inode_path (ioc_inode->inode, NULL, &path);
@@ -2031,7 +2031,7 @@ unlock:
 out:
         if (ret && ioc_inode) {
                 if (section_added == _gf_false)
-                        gf_proc_dump_add_section (key_prefix);
+                        gf_proc_dump_add_section ("%s", key_prefix);
                 gf_proc_dump_write ("Unable to print the status of ioc_inode",
                                     "(Lock acquisition failed) %s",
                                     uuid_utoa (inode->gfid));
@@ -2053,7 +2053,7 @@ ioc_priv_dump (xlator_t *this)
         priv = this->private;
 
         gf_proc_dump_build_key (key_prefix, "io-cache", "priv");
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
         add_section = _gf_true;
 
         ret = pthread_mutex_trylock (&priv->table_lock);
@@ -2074,7 +2074,7 @@ out:
                 if (!add_section) {
                         gf_proc_dump_build_key (key_prefix, "xlator."
                                                 "performance.io-cache", "priv");
-                        gf_proc_dump_add_section (key_prefix);
+                        gf_proc_dump_add_section ("%s", key_prefix);
                 }
                 gf_proc_dump_write ("Unable to dump the state of private "
                                     "structure of io-cache xlator", "(Lock "
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index 5c47072..41d48ab 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -911,7 +911,7 @@ iot_priv_dump (xlator_t *this)
         snprintf (key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type,
                   this->name);
 
-        gf_proc_dump_add_section(key_prefix);
+        gf_proc_dump_add_section("%s", key_prefix);
 
         gf_proc_dump_write("maximum_threads_count", "%d", conf->max_count);
         gf_proc_dump_write("current_threads_count", "%d", conf->curr_count);
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
index 9d2eea6..e7452e9 100644
--- a/xlators/performance/md-cache/src/md-cache.c
+++ b/xlators/performance/md-cache/src/md-cache.c
@@ -3087,7 +3087,7 @@ mdc_priv_dump (xlator_t *this)
         conf = this->private;
 
         snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name);
-        gf_proc_dump_add_section(key_prefix);
+        gf_proc_dump_add_section("%s", key_prefix);
 
         gf_proc_dump_write("stat_hit_count", "%"PRId64,
                            conf->mdc_counter.stat_hit.cnt);
diff --git a/xlators/performance/nl-cache/src/nl-cache-helper.c b/xlators/performance/nl-cache/src/nl-cache-helper.c
index 0b6c884..583d67b 100644
--- a/xlators/performance/nl-cache/src/nl-cache-helper.c
+++ b/xlators/performance/nl-cache/src/nl-cache-helper.c
@@ -1177,7 +1177,7 @@ nlc_dump_inodectx (xlator_t *this, inode_t *inode)
                 gf_proc_dump_build_key (key_prefix,
                                         "xlator.performance.nl-cache",
                                         "nlc_inode");
-                gf_proc_dump_add_section (key_prefix);
+                gf_proc_dump_add_section ("%s", key_prefix);
 
                 __inode_path (inode, NULL, &path);
                 if (path != NULL) {
diff --git a/xlators/performance/nl-cache/src/nl-cache.c b/xlators/performance/nl-cache/src/nl-cache.c
index 7dad8d9..6365d82 100644
--- a/xlators/performance/nl-cache/src/nl-cache.c
+++ b/xlators/performance/nl-cache/src/nl-cache.c
@@ -615,7 +615,7 @@ nlc_priv_dump (xlator_t *this)
         conf = this->private;
 
         snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s", this->type, this->name);
-        gf_proc_dump_add_section(key_prefix);
+        gf_proc_dump_add_section("%s", key_prefix);
 
         gf_proc_dump_write("negative_lookup_hit_count", "%"PRId64,
                            conf->nlc_counter.nlc_hit.cnt);
diff --git a/xlators/performance/open-behind/src/open-behind.c b/xlators/performance/open-behind/src/open-behind.c
index 3be35bc..2d77f2d 100644
--- a/xlators/performance/open-behind/src/open-behind.c
+++ b/xlators/performance/open-behind/src/open-behind.c
@@ -897,7 +897,7 @@ ob_priv_dump (xlator_t *this)
         gf_proc_dump_build_key (key_prefix, "xlator.performance.open-behind",
                                 "priv");
 
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
 
         gf_proc_dump_write ("use_anonymous_fd", "%d", conf->use_anonymous_fd);
 
@@ -926,7 +926,7 @@ ob_fdctx_dump (xlator_t *this, fd_t *fd)
 
         gf_proc_dump_build_key (key_prefix, "xlator.performance.open-behind",
                                 "file");
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
 
         gf_proc_dump_write ("fd", "%p", fd);
 
diff --git a/xlators/performance/quick-read/src/quick-read.c b/xlators/performance/quick-read/src/quick-read.c
index 61232c1..ca228b8 100644
--- a/xlators/performance/quick-read/src/quick-read.c
+++ b/xlators/performance/quick-read/src/quick-read.c
@@ -748,7 +748,7 @@ qr_inodectx_dump (xlator_t *this, inode_t *inode)
 
         gf_proc_dump_build_key (key_prefix, "xlator.performance.quick-read",
                                 "inodectx");
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
 
         gf_proc_dump_write ("entire-file-cached", "%s", qr_inode->data ? "yes" : "no");
 
@@ -794,7 +794,7 @@ qr_priv_dump (xlator_t *this)
         gf_proc_dump_build_key (key_prefix, "xlator.performance.quick-read",
                                 "priv");
 
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
 
         gf_proc_dump_write ("max_file_size", "%d", conf->max_file_size);
         gf_proc_dump_write ("cache_timeout", "%d", conf->cache_timeout);
diff --git a/xlators/performance/read-ahead/src/read-ahead.c b/xlators/performance/read-ahead/src/read-ahead.c
index 242b579..74ddf49 100644
--- a/xlators/performance/read-ahead/src/read-ahead.c
+++ b/xlators/performance/read-ahead/src/read-ahead.c
@@ -823,7 +823,7 @@ ra_fdctx_dump (xlator_t *this, fd_t *fd)
                                 "xlator.performance.read-ahead",
                                 "file");
 
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
 
         ret = __inode_path (fd->inode, NULL, &path);
         if (path != NULL) {
@@ -1068,7 +1068,7 @@ ra_priv_dump (xlator_t *this)
         gf_proc_dump_build_key (key_prefix, "xlator.performance.read-ahead",
                                 "priv");
 
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
         add_section = _gf_true;
 
         ret = pthread_mutex_trylock (&conf->conf_lock);
@@ -1086,7 +1086,7 @@ ra_priv_dump (xlator_t *this)
 out:
         if (ret && conf) {
                 if (add_section == _gf_false)
-                        gf_proc_dump_add_section (key_prefix);
+                        gf_proc_dump_add_section ("%s", key_prefix);
 
                 gf_proc_dump_write ("Unable to dump priv",
                                     "(Lock acquisition failed) %s", this->name);
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 478985a..ef02e18 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -2763,7 +2763,7 @@ wb_priv_dump (xlator_t *this)
         gf_proc_dump_build_key (key_prefix, "xlator.performance.write-behind",
                                 "priv");
 
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
 
         gf_proc_dump_write ("aggregate_size", "%d", conf->aggregate_size);
         gf_proc_dump_write ("window_size", "%d", conf->window_size);
@@ -2787,7 +2787,7 @@ __wb_dump_requests (struct list_head *head, char *prefix)
                 gf_proc_dump_build_key (key_prefix, key, "%s",
                                         (char *)gf_fop_list[req->fop]);
 
-                gf_proc_dump_add_section(key_prefix);
+                gf_proc_dump_add_section("%s", key_prefix);
 
                 gf_proc_dump_write ("unique", "%"PRIu64, req->unique);
 
@@ -2859,7 +2859,7 @@ wb_inode_dump (xlator_t *this, inode_t *inode)
         gf_proc_dump_build_key (key_prefix, "xlator.performance.write-behind",
                                 "wb_inode");
 
-        gf_proc_dump_add_section (key_prefix);
+        gf_proc_dump_add_section ("%s", key_prefix);
 
         __inode_path (inode, NULL, &path);
         if (path != NULL) {
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 26b0907..674f1aa 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -2855,7 +2855,7 @@ client_priv_dump (xlator_t *this)
         gf_proc_dump_build_key(key_prefix, "xlator.protocol.client",
                                "%s.priv", this->name);
 
-        gf_proc_dump_add_section(key_prefix);
+        gf_proc_dump_add_section("%s", key_prefix);
 
         list_for_each_entry(tmp, &conf->saved_fds, sfd_pos) {
                 sprintf (key, "fd.%d.remote_fd", i);
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index d0e815e..3a429bc 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -320,7 +320,7 @@ server_priv (xlator_t *this)
                 return 0;
 
         gf_proc_dump_build_key (key, "xlator.protocol.server", "priv");
-        gf_proc_dump_add_section (key);
+        gf_proc_dump_add_section ("%s", key);
 
         ret = pthread_mutex_trylock (&conf->mutex);
         if (ret != 0)
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index f79dbda..7bfe780 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -6960,7 +6960,7 @@ posix_priv (xlator_t *this)
 
         (void) snprintf(key_prefix, GF_DUMP_MAX_BUF_LEN, "%s.%s",
                         this->type, this->name);
-        gf_proc_dump_add_section(key_prefix);
+        gf_proc_dump_add_section("%s", key_prefix);
 
         if (!this)
                 return 0;
-- 
1.8.3.1