gfs2-utils: master - fsck.gfs2: Remove unsigned comparisons with zero
Andrew Price
andyp at fedoraproject.org
Wed Jan 11 18:39:54 UTC 2012
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=a0c6128c8aa3a15604c6bd2214762cef207fa8d1
Commit: a0c6128c8aa3a15604c6bd2214762cef207fa8d1
Parent: 55626ed257b0ae681e817e586e7b654e7ceec782
Author: Andrew Price <anprice at redhat.com>
AuthorDate: Wed Jan 11 16:54:01 2012 +0000
Committer: Andrew Price <anprice at redhat.com>
CommitterDate: Wed Jan 11 18:17:56 2012 +0000
fsck.gfs2: Remove unsigned comparisons with zero
Spotted by coverity: This less-than-zero comparison of an unsigned value
is never true. "q < 0". (Fixes 6 occurrences)
Signed-off-by: Andrew Price <anprice at redhat.com>
---
gfs2/fsck/metawalk.c | 9 +++------
gfs2/fsck/pass1b.c | 2 +-
gfs2/fsck/pass2.c | 2 +-
gfs2/fsck/pass5.c | 6 ------
4 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/gfs2/fsck/metawalk.c b/gfs2/fsck/metawalk.c
index d78df72..eb80ccf 100644
--- a/gfs2/fsck/metawalk.c
+++ b/gfs2/fsck/metawalk.c
@@ -1530,8 +1530,7 @@ static int alloc_metalist(struct gfs2_inode *ip, uint64_t block,
after the bitmap has been set but before the blockmap has. */
*bh = bread(ip->i_sbd, block);
q = block_type(block);
- if (q < 0 ||
- blockmap_to_bitmap(q, ip->i_sbd->gfs1) == GFS2_BLKST_FREE) {
+ if (blockmap_to_bitmap(q, ip->i_sbd->gfs1) == GFS2_BLKST_FREE) {
log_debug(_("%s reference to new metadata block "
"%lld (0x%llx) is now marked as indirect.\n"),
desc, (unsigned long long)block,
@@ -1550,8 +1549,7 @@ static int alloc_data(struct gfs2_inode *ip, uint64_t block, void *private)
/* We can't check the bitmap here because this function is called
after the bitmap has been set but before the blockmap has. */
q = block_type(block);
- if (q < 0 ||
- blockmap_to_bitmap(q, ip->i_sbd->gfs1) == GFS2_BLKST_FREE) {
+ if (blockmap_to_bitmap(q, ip->i_sbd->gfs1) == GFS2_BLKST_FREE) {
log_debug(_("%s reference to new data block "
"%lld (0x%llx) is now marked as data.\n"),
desc, (unsigned long long)block,
@@ -1569,8 +1567,7 @@ static int alloc_leaf(struct gfs2_inode *ip, uint64_t block, void *private)
/* We can't check the bitmap here because this function is called
after the bitmap has been set but before the blockmap has. */
q = block_type(block);
- if (q < 0 ||
- blockmap_to_bitmap(q, ip->i_sbd->gfs1) == GFS2_BLKST_FREE)
+ if (blockmap_to_bitmap(q, ip->i_sbd->gfs1) == GFS2_BLKST_FREE)
fsck_blockmap_set(ip, block, _("newly allocated leaf"),
gfs2_leaf_blk);
return 0;
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index 1879cc4..ae6d45c 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -701,7 +701,7 @@ static int handle_dup_blk(struct gfs2_sbd *sdp, struct duptree *b)
ip = fsck_load_inode(sdp, id->block_no);
q = block_type(id->block_no);
- if (q < 0 || q == gfs2_inode_invalid) {
+ if (q == gfs2_inode_invalid) {
log_debug( _("The remaining reference inode %lld "
"(0x%llx) is marked invalid: Marking "
"the block as free.\n"),
diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 8562b6a..d89dd4f 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -328,7 +328,7 @@ static int check_dentry(struct gfs2_inode *ip, struct gfs2_dirent *dent,
* 2. Blocks marked "bad" need to have their entire
* metadata tree deleted.
*/
- if (q < 0 || q == gfs2_inode_invalid || q == gfs2_bad_block) {
+ if (q == gfs2_inode_invalid || q == gfs2_bad_block) {
/* This entry's inode has bad blocks in it */
/* Handle bad blocks */
diff --git a/gfs2/fsck/pass5.c b/gfs2/fsck/pass5.c
index cb18b5a..6c08e13 100644
--- a/gfs2/fsck/pass5.c
+++ b/gfs2/fsck/pass5.c
@@ -123,12 +123,6 @@ static int check_block_status(struct gfs2_sbd *sdp, char *buffer,
return 0;
q = block_type(block);
- if (q < 0) {
- log_err( _("Invalid block type for block #%llu "
- "(0x%llx)\n"), (unsigned long long)block,
- (unsigned long long)block);
- return q;
- }
if (sdp->gfs1)
block_status = gfs1_convert_mark(q, count);
More information about the cluster-commits
mailing list