FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 01-11-2012, 05:21 PM
Andrew Price
 
Default 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@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.
"),
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.
"),
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.
"),
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)
"), (unsigned long long)block,
- (unsigned long long)block);
- return q;
- }

if (sdp->gfs1)
block_status = gfs1_convert_mark(q, count);
--
1.7.6.5
 

Thread Tools




All times are GMT. The time now is 04:20 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org