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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe reiserfs-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux File System Development]     [Linux BTRFS]     [Linux NFS]     [Linux Filesystems]     [Ext4 Filesystem]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Resources]

  Powered by Linux