gfs2-utils: RHEL7 - libgfs2: Fix an impossible loop condition in gfs2_rgrp_read

Andrew Price andyp at fedoraproject.org
Mon Sep 8 17:34:13 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=f072015b16d4a28b3fa9c7512794af7602500f0b
Commit:        f072015b16d4a28b3fa9c7512794af7602500f0b
Parent:        e42a9392ecd663ea82903e9a3a86952ad9fc0af0
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Sat Aug 30 00:06:28 2014 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Fri Sep 5 14:57:46 2014 +0100

libgfs2: Fix an impossible loop condition in gfs2_rgrp_read

Correct a loop which expects an unsigned int to become negative.

Signed-off-by: Andrew Price <anprice at redhat.com>
---
 gfs2/libgfs2/rgrp.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gfs2/libgfs2/rgrp.c b/gfs2/libgfs2/rgrp.c
index e929846..56b73ae 100644
--- a/gfs2/libgfs2/rgrp.c
+++ b/gfs2/libgfs2/rgrp.c
@@ -131,10 +131,10 @@ uint64_t gfs2_rgrp_read(struct gfs2_sbd *sdp, struct rgrp_tree *rgd)
 		bi->bi_bh = bhs[x];
 		if (gfs2_check_meta(bi->bi_bh, mtype)) {
 			unsigned err = x;
-			for (; x >= 0; x--) {
+			do {
 				brelse(rgd->bits[x].bi_bh);
 				rgd->bits[x].bi_bh = NULL;
-			}
+			} while (x-- != 0);
 			free(bhs);
 			return rgd->ri.ri_addr + err;
 		}


More information about the cluster-commits mailing list