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 gfs2_edit: Check more error values from gfs2_get_bitmap

Spotted by coverity: gfs2_get_bitmap returns -1 on error and it was
being used as an array index in display_block_type. (2 remaining
occurrences.)

Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/edit/hexedit.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index 69d499e..808ebb1 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -697,8 +697,13 @@ int display_block_type(int from_restore)
if ((be32_to_cpu(mh->mh_type) == GFS2_METATYPE_RG) ||
(be32_to_cpu(mh->mh_type) == GFS2_METATYPE_RB))
type = 4;
- else
+ else {
type = gfs2_get_bitmap(&sbd, block, rgd);
+ if (type < 0) {
+ fprintf(stderr, "Failed to retrieve block state from bitmap
");
+ exit(-1);
+ }
+ }
} else
type = 4;
screen_chunk_size = ((termlines - 4) * 16) >> 8 << 8;
@@ -724,6 +729,10 @@ int display_block_type(int from_restore)
print_gfs2(" blk ");
for (b = blknum; b < blknum + 4; b++) {
btype = gfs2_get_bitmap(&sbd, b, rgd);
+ if (btype < 0) {
+ fprintf(stderr, "Failed to retrieve block state from bitmap
");
+ exit(-1);
+ }
print_gfs2("0x%x-%s ", b,
allocdesc[sbd.gfs1][btype]);
}
--
1.7.6.5
 

Thread Tools




All times are GMT. The time now is 12:45 PM.

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