cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] GFS2: Avoid uninitialized variable warning (reprise)
@ 2016-05-25 17:20 Andrew Price
  2016-05-26 12:37 ` Bob Peterson
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Price @ 2016-05-25 17:20 UTC (permalink / raw)
  To: cluster-devel.redhat.com

Commit 67893f12e attempted to fix these warnings:

fs/gfs2/dir.c: In function 'get_first_leaf':
fs/gfs2/dir.c:802:9: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
fs/gfs2/dir.c: In function 'dir_split_leaf.isra.26':
fs/gfs2/dir.c:1021:8: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]

but they persisted. Fix them once and for all by initializing leaf_no.

Signed-off-by: Andrew Price <anprice@redhat.com>
---
 fs/gfs2/dir.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 4a01f30..3182c46 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -794,7 +794,7 @@ static int get_leaf_nr(struct gfs2_inode *dip, u32 index,
 static int get_first_leaf(struct gfs2_inode *dip, u32 index,
 			  struct buffer_head **bh_out)
 {
-	u64 leaf_no;
+	u64 leaf_no = 0;
 	int error;
 
 	error = get_leaf_nr(dip, index, &leaf_no);
@@ -1006,7 +1006,7 @@ static int dir_split_leaf(struct inode *inode, const struct qstr *name)
 	struct gfs2_leaf *nleaf, *oleaf;
 	struct gfs2_dirent *dent = NULL, *prev = NULL, *next = NULL, *new;
 	u32 start, len, half_len, divider;
-	u64 bn, leaf_no;
+	u64 bn, leaf_no = 0;
 	__be64 *lp;
 	u32 index;
 	int x, moved = 0;
-- 
2.4.11



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-26 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-25 17:20 [Cluster-devel] [PATCH] GFS2: Avoid uninitialized variable warning (reprise) Andrew Price
2016-05-26 12:37 ` Bob Peterson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).