cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] GFS2: Avoid uninitialized variable warning (reprise)
Date: Wed, 25 May 2016 18:20:43 +0100	[thread overview]
Message-ID: <1464196843-26009-1-git-send-email-anprice@redhat.com> (raw)

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



             reply	other threads:[~2016-05-25 17:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 17:20 Andrew Price [this message]
2016-05-26 12:37 ` [Cluster-devel] [PATCH] GFS2: Avoid uninitialized variable warning (reprise) Bob Peterson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1464196843-26009-1-git-send-email-anprice@redhat.com \
    --to=anprice@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).