gfs2-utils: RHEL7 - gfs2_edit: Fix signed value used as array index in print_ld_blks

Andrew Price andyp at fedoraproject.org
Tue Apr 7 21:22:21 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=e8fdcc705d2ac36b5151072fc2acef15d0b32ad2
Commit:        e8fdcc705d2ac36b5151072fc2acef15d0b32ad2
Parent:        0e67e7af3b13e47aff2957ccc00c077a68b3f025
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Thu Sep 18 14:27:17 2014 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Wed Apr 1 16:51:34 2015 +0100

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 <anprice at redhat.com>
---
 gfs2/edit/journal.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

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)",


More information about the cluster-commits mailing list