Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1303786

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

From tim.gardner@canonical.com
Newsgroups linux.kernel
Subject [PATCH v4.4-rc8] fs/reiserfs: Squelch new_insert_key 'may be used uninitialized' warning
Date 2016-01-07 19:30 +0100
Message-ID <qOntV-3ug-35@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: Tim Gardner <tim.gardner@canonical.com>

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@canonical.com>
---

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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH v4.4-rc8] fs/reiserfs: Squelch new_insert_key 'may be used uninitialized' warning tim.gardner@canonical.com - 2016-01-07 19:30 +0100

csiph-web