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

Andrew Price andyp at fedoraproject.org
Fri Sep 5 13:39:20 UTC 2014


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=04aa942a2e4967974869d845be6b12850a210928
Commit:        04aa942a2e4967974869d845be6b12850a210928
Parent:        6672ca092b33897d527b1ae9bbef774513ca3b66
Author:        Andrew Price <anprice at redhat.com>
AuthorDate:    Sat Aug 30 00:06:28 2014 +0100
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Mon Sep 1 11:11:54 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