Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=34f... Commit: 34f59b17a3f5fdc00b4f6a906c9a1e1d23445dc2 Parent: e3a51f9addfa5443d8570d6ccdfbd67ecd9b4d6b Author: Andrew Price anprice@redhat.com AuthorDate: Fri Jan 6 13:56:29 2012 +0000 Committer: Andrew Price anprice@redhat.com CommitterDate: Fri Jan 6 13:56:29 2012 +0000
gfs2_edit: Check for error value 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.
Signed-off-by: Andrew Price anprice@redhat.com --- gfs2/edit/hexedit.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c index f58657b..02a4091 100644 --- a/gfs2/edit/hexedit.c +++ b/gfs2/edit/hexedit.c @@ -756,6 +756,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\n"); + exit(-1); + } print_gfs2("0x%x-%s ", b, allocdesc[sbd.gfs1][btype]); }
cluster-commits@lists.fedorahosted.org