From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Price Date: Wed, 25 May 2016 18:20:43 +0100 Subject: [Cluster-devel] [PATCH] GFS2: Avoid uninitialized variable warning (reprise) Message-ID: <1464196843-26009-1-git-send-email-anprice@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- 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