[PATCH] tux3: use uninitialized_var() to fix compile errors

Dongsu Park dongsu.park at profitbricks.com
Thu May 22 02:53:17 PDT 2014


From: Dongsu Park <dongsu.park at profitbricks.com>

Use uninitialized_var() to avoid fix compile errors like the following:

fs/tux3/dir.c: In function ‘tux_alloc_entry’:
fs/tux3/dir.c:195:13: error: ‘rec_len’ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
    unsigned rest_rec_len = rec_len - name_len;
             ^
cc1: all warnings being treated as errors
make[1]: *** [fs/tux3/dir.o] Error 1

Tested with gcc 4.8.2 under Ubuntu trusty and Debian wheezy.

Cc: Daniel Phillips <daniel at phunq.net>
Cc: OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>
Signed-off-by: Dongsu Park <dongsu.park at profitbricks.com>
---
 fs/tux3/dir.c       | 3 ++-
 fs/tux3/filemap.c   | 2 +-
 fs/tux3/writeback.c | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/fs/tux3/dir.c b/fs/tux3/dir.c
index 26feaa5a6061..a2a7db174059 100644
--- a/fs/tux3/dir.c
+++ b/fs/tux3/dir.c
@@ -135,7 +135,8 @@ loff_t tux_alloc_entry(struct inode *dir, const char *name, unsigned len,
 	struct sb *sb = tux_sb(dir->i_sb);
 	struct tux3_dirent *entry;
 	struct buffer_head *buffer, *clone;
-	unsigned reclen = TUX_REC_LEN(len), rec_len, offset;
+	unsigned reclen = TUX_REC_LEN(len), offset;
+	unsigned uninitialized_var(rec_len);
 	unsigned uninitialized_var(name_len);
 	unsigned blocksize = sb->blocksize;
 	block_t block, blocks = *size >> sb->blockbits;
diff --git a/fs/tux3/filemap.c b/fs/tux3/filemap.c
index 52908b163c94..7c502d499e59 100644
--- a/fs/tux3/filemap.c
+++ b/fs/tux3/filemap.c
@@ -456,7 +456,7 @@ static int filemap_extent_io(enum map_mode mode, int rw, struct bufvec *bufvec)
 	struct inode *inode = bufvec_inode(bufvec);
 	block_t block, index = bufvec_contig_index(bufvec);
 	unsigned count = bufvec_contig_count(bufvec);
-	int err;
+	int uninitialized_var(err);
 	struct block_segment seg[10];
 
 	/* FIXME: For now, this is only for write */
diff --git a/fs/tux3/writeback.c b/fs/tux3/writeback.c
index 9ecafc0f8ffe..9adc39d2d188 100644
--- a/fs/tux3/writeback.c
+++ b/fs/tux3/writeback.c
@@ -183,7 +183,7 @@ void tux3_dirty_inode(struct inode *inode, int flags)
 	unsigned delta = tux3_inode_delta(inode);
 	unsigned mask = tux3_dirty_mask(flags, delta);
 	struct sb_delta_dirty *s_ddc;
-	struct inode_delta_dirty *i_ddc;
+	struct inode_delta_dirty *uninitialized_var(i_ddc);
 	int re_dirtied = 0;
 
 	if ((tuxnode->flags & mask) == mask)
-- 
1.9.1




More information about the Tux3 mailing list