From: Andrew Price Date: Tue, 2 Sep 2014 13:07:20 +0100 Subject: [Cluster-devel] [PATCH 03/19] libgfs2: Fix an impossible loop condition in gfs2_rgrp_read In-Reply-To: <1409659656-23051-1-git-send-email-anprice@redhat.com> References: <1409659656-23051-1-git-send-email-anprice@redhat.com> Message-ID: <1409659656-23051-4-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 Correct a loop which expects an unsigned int to become negative. Signed-off-by: Andrew Price --- gfs2/libgfs2/rgrp.c | 4 ++-- 1 file 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; } -- 1.9.3