[PATCH v4.4-rc8] fs/reiserfs: Squelch new_insert_key 'may be used uninitialized' warning

From: tim . gardner
Date: Thu Jan 07 2016 - 13:24:56 EST


From: Tim Gardner <tim.gardner@xxxxxxxxxxxxx>

fs/reiserfs/ibalance.c: In function 'balance_internal':
fs/reiserfs/ibalance.c:1156:2: warning: 'new_insert_key' may be used uninitialized in this function [-Wmaybe-uninitialized]
memcpy(new_insert_key_addr, &new_insert_key, KEY_SIZE);

gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1)

Signed-off-by: Tim Gardner <tim.gardner@xxxxxxxxxxxxx>
---

It seems unlikely in practice that new_insert_key will get used before being set,
but I can see how the compiler might think that.

fs/reiserfs/ibalance.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/fs/reiserfs/ibalance.c b/fs/reiserfs/ibalance.c
index b751eea..f16d50e 100644
--- a/fs/reiserfs/ibalance.c
+++ b/fs/reiserfs/ibalance.c
@@ -850,6 +850,8 @@ int balance_internal(struct tree_balance *tb,
return order;
}

+ memset(&new_insert_key, 0, sizeof(new_insert_key));
+
k = 0;
if (tb->lnum[h] > 0) {
/*
--
1.9.1