From: Andrew Price Date: Fri, 6 Jan 2012 15:19:27 +0000 Subject: [Cluster-devel] [PATCH 08/11] gfs2_edit: Check for error value from gfs2_get_bitmap In-Reply-To: <1325863170-32530-1-git-send-email-anprice@redhat.com> References: <1325863170-32530-1-git-send-email-anprice@redhat.com> Message-ID: <1325863170-32530-8-git-send-email-anprice@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- 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]); } -- 1.7.6.4