From: Steven Whitehouse <swhiteho@redhat.com>
To: linux-kernel@vger.kernel.org, cluster-devel@redhat.com
Cc: Steven Whitehouse <swhiteho@redhat.com>
Subject: [PATCH 03/16] GFS2: More automated code analysis fixes
Date: Thu, 5 Jan 2012 11:51:49 +0000 [thread overview]
Message-ID: <1325764322-10807-4-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <1325764322-10807-1-git-send-email-swhiteho@redhat.com>
A potentially uninitialised variable, some unreachable code,
and the main part of this, fixing the error path in the
unlink function.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 41d494d..f6be14f 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -743,9 +743,6 @@ static int do_strip(struct gfs2_inode *ip, struct buffer_head *dibh,
else if (ip->i_depth)
revokes = sdp->sd_inptrs;
- if (error)
- return error;
-
memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));
bstart = 0;
blen = 0;
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c
index 46f6f9a..6336bc6 100644
--- a/fs/gfs2/file.c
+++ b/fs/gfs2/file.c
@@ -609,7 +609,7 @@ static int gfs2_fsync(struct file *file, loff_t start, loff_t end,
struct inode *inode = mapping->host;
int sync_state = inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC);
struct gfs2_inode *ip = GFS2_I(inode);
- int ret, ret1 = 0;
+ int ret = 0, ret1 = 0;
if (mapping->nrpages) {
ret1 = filemap_fdatawrite_range(mapping, start, end);
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index cfd4959..377920d 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1037,12 +1037,14 @@ static int gfs2_unlink(struct inode *dir, struct dentry *dentry)
struct buffer_head *bh;
struct gfs2_holder ghs[3];
struct gfs2_rgrpd *rgd;
- int error;
+ int error = -EROFS;
gfs2_holder_init(dip->i_gl, LM_ST_EXCLUSIVE, 0, ghs);
gfs2_holder_init(ip->i_gl, LM_ST_EXCLUSIVE, 0, ghs + 1);
rgd = gfs2_blk2rgrpd(sdp, ip->i_no_addr);
+ if (!rgd)
+ goto out_inodes;
gfs2_holder_init(rgd->rd_gl, LM_ST_EXCLUSIVE, 0, ghs + 2);
@@ -1088,12 +1090,13 @@ out_end_trans:
out_gunlock:
gfs2_glock_dq(ghs + 2);
out_rgrp:
- gfs2_holder_uninit(ghs + 2);
gfs2_glock_dq(ghs + 1);
out_child:
- gfs2_holder_uninit(ghs + 1);
gfs2_glock_dq(ghs);
out_parent:
+ gfs2_holder_uninit(ghs + 2);
+out_inodes:
+ gfs2_holder_uninit(ghs + 1);
gfs2_holder_uninit(ghs);
return error;
}
--
1.7.4
next prev parent reply other threads:[~2012-01-05 12:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-05 11:51 GFS2: Pre-pull patch posting (merge window) Steven Whitehouse
2012-01-05 11:51 ` [PATCH 01/16] GFS2: Fix up REQ flags Steven Whitehouse
2012-01-05 11:51 ` [PATCH 02/16] GFS2: Add readahead to sequential directory traversal Steven Whitehouse
2012-01-05 11:51 ` Steven Whitehouse [this message]
2012-01-05 11:51 ` [PATCH 04/16] GFS2: Fix very unlikley memory leak in ACL xattr code Steven Whitehouse
2012-01-05 11:51 ` [PATCH 05/16] GFS2: f_ra is always valid in dir readahead function Steven Whitehouse
2012-01-05 11:51 ` [PATCH 06/16] GFS2: Add non-try locks back to get_local_rgrp Steven Whitehouse
2012-01-05 11:51 ` [PATCH 07/16] GFS2: combine gfs2_alloc_block and gfs2_alloc_di Steven Whitehouse
2012-01-05 11:51 ` [PATCH 08/16] GFS2: remove vestigial al_alloced Steven Whitehouse
2012-01-05 11:51 ` [PATCH 09/16] GFS2: O_(D)SYNC support for fallocate Steven Whitehouse
2012-01-05 11:51 ` [PATCH 10/16] GFS2: move toward a generic multi-block allocator Steven Whitehouse
2012-01-05 11:51 ` [PATCH 11/16] GFS2: Fix up "off by one" in the previous patch Steven Whitehouse
2012-01-05 11:51 ` [PATCH 12/16] GFS2: split function rgblk_search Steven Whitehouse
2012-01-05 11:51 ` [PATCH 13/16] GFS2: decouple quota allocations from block allocations Steven Whitehouse
2012-01-05 11:52 ` [PATCH 14/16] GFS2: Fix multi-block allocation Steven Whitehouse
2012-01-05 11:52 ` [PATCH 15/16] GFS2: We only need one ACL getting function Steven Whitehouse
2012-01-05 11:52 ` [PATCH 16/16] GFS2: local functions should be static Steven Whitehouse
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=1325764322-10807-4-git-send-email-swhiteho@redhat.com \
--to=swhiteho@redhat.com \
--cc=cluster-devel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®