From e8fdcc705d2ac36b5151072fc2acef15d0b32ad2 Mon Sep 17 00:00:00 2001 From: Andrew Price Date: Apr 01 2015 15:51:34 +0000 Subject: gfs2_edit: Fix signed value used as array index in print_ld_blks Spotted by coverity: Using variable "type" as an index to array "allocdesc[sbd.gfs1]". Signed-off-by: Andrew Price --- diff --git a/gfs2/edit/journal.c b/gfs2/edit/journal.c index 5b824a4..58f4798 100644 --- a/gfs2/edit/journal.c +++ b/gfs2/edit/journal.c @@ -263,9 +263,12 @@ static int print_ld_blks(const uint64_t *b, const char *end, int start_line, j_bmap_bh = bread(&sbd, abs_block + bcount); rgd->bits[bmap].bi_bh = j_bmap_bh; - type = lgfs2_get_bitmap(&sbd, tblk, - rgd); + type = lgfs2_get_bitmap(&sbd, tblk, rgd); brelse(j_bmap_bh); + if (type < 0) { + perror("Error printing log descriptor blocks"); + exit(1); + } rgd->bits[bmap].bi_bh = save_bh; print_gfs2("bit for blk 0x%llx is %d " "(%s)",