[Ocfs2-tools-devel] [PATCH 5/5] tools: Fix build warnings

Sunil Mushran sunil.mushran at oracle.com
Thu Dec 16 13:35:17 PST 2010


chain.c: In function ‘ocfs2_get_block_from_group’:
chain.c:283: warning: ‘rec’ may be used uninitialized in this function

dir_indexed.c: In function ‘ocfs2_read_dx_leaves’:
dir_indexed.c:673: warning: ‘ret’ may be used uninitialized in this function

dir_indexed.c: In function ‘ocfs2_dx_dir_insert’:
dir_indexed.c:753: warning: ‘ret’ may be used uninitialized in this function

feature_discontig_bg.c: In function ‘disable_discontig_bg’:
feature_discontig_bg.c:240: warning: ‘prog’ may be used uninitialized in this function

Signed-off-by: Sunil Mushran <sunil.mushran at oracle.com>
---
 libocfs2/chain.c                    |    4 ++--
 libocfs2/dir_indexed.c              |    4 ++--
 tunefs.ocfs2/feature_discontig_bg.c |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/libocfs2/chain.c b/libocfs2/chain.c
index 1111325..f412fa1 100644
--- a/libocfs2/chain.c
+++ b/libocfs2/chain.c
@@ -280,7 +280,7 @@ uint64_t ocfs2_get_block_from_group(ocfs2_filesys *fs,
 				    int bpc, int bit_offset)
 {
 	int cpos, i;
-	struct ocfs2_extent_rec *rec;
+	struct ocfs2_extent_rec *rec = NULL;
 	int block_per_bit = ocfs2_clusters_to_blocks(fs, 1) / bpc;
 
 	if (!ocfs2_gd_is_discontig(grp))
@@ -296,7 +296,7 @@ uint64_t ocfs2_get_block_from_group(ocfs2_filesys *fs,
 			break;
 	}
 
-	if (i == grp->bg_list.l_next_free_rec)
+	if (!rec || i == grp->bg_list.l_next_free_rec)
 		abort();
 
 	return rec->e_blkno + (bit_offset * block_per_bit -
diff --git a/libocfs2/dir_indexed.c b/libocfs2/dir_indexed.c
index 89f14ee..41a0d1a 100644
--- a/libocfs2/dir_indexed.c
+++ b/libocfs2/dir_indexed.c
@@ -670,7 +670,7 @@ static errcode_t ocfs2_read_dx_leaves(ocfs2_filesys *fs,
 				int num,
 				struct ocfs2_dx_leaf **dx_leaves)
 {
-	errcode_t ret;
+	errcode_t ret = 0;
 	int i;
 	struct ocfs2_dx_leaf *dx_leaf;
 	for (i = 0; i < num; i++) {
@@ -750,7 +750,7 @@ static errcode_t ocfs2_dx_dir_transfer_leaf(ocfs2_filesys *fs,
 				uint64_t new_dx_leaves_blkno,
 				int num_dx_leaves)
 {
-	errcode_t ret;
+	errcode_t ret = 0;
 	int i, j, num_used;
 	uint32_t major_hash;
 	struct ocfs2_dx_leaf *orig_dx_leaf, *new_dx_leaf;
diff --git a/tunefs.ocfs2/feature_discontig_bg.c b/tunefs.ocfs2/feature_discontig_bg.c
index 6c903f1..10bfa8c 100644
--- a/tunefs.ocfs2/feature_discontig_bg.c
+++ b/tunefs.ocfs2/feature_discontig_bg.c
@@ -237,7 +237,7 @@ static int disable_discontig_bg(ocfs2_filesys *fs, int flags)
 {
 	errcode_t ret = 0;
 	struct ocfs2_super_block *super = OCFS2_RAW_SB(fs->fs_super);
-	struct tools_progress *prog;
+	struct tools_progress *prog = NULL;
 	struct no_discontig_bg_ctxt ctxt;
 	struct discontig_bg *tmp;
 
-- 
1.7.1




More information about the Ocfs2-tools-devel mailing list