[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 4/8] gfs2_convert: Fix null pointer deref in journ_space_to_rg



Spotted by coverity: Dereferencing null variable "rgdhigh".

Signed-off-by: Andrew Price <anprice redhat com>
---
 gfs2/convert/gfs2_convert.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/gfs2/convert/gfs2_convert.c b/gfs2/convert/gfs2_convert.c
index 307b0f3..9b54670 100644
--- a/gfs2/convert/gfs2_convert.c
+++ b/gfs2/convert/gfs2_convert.c
@@ -1777,13 +1777,13 @@ static int journ_space_to_rg(struct gfs2_sbd *sdp)
 				 (rgd->ri.ri_addr > rgdhigh->ri.ri_addr)))
 				rgdhigh = rgd;
 		} /* for each rg */
-		log_info(_("Addr 0x%llx comes after rg at addr 0x%llx\n"),
-			 (unsigned long long)jndx->ji_addr,
-			 (unsigned long long)rgdhigh->ri.ri_addr);
 		if (!rgdhigh) { /* if we somehow didn't find one. */
 			log_crit(_("Error: No suitable rg found for journal.\n"));
 			return -1;
 		}
+		log_info(_("Addr 0x%llx comes after rg at addr 0x%llx\n"),
+			 (unsigned long long)jndx->ji_addr,
+			 (unsigned long long)rgdhigh->ri.ri_addr);
 		ri_addr = jndx->ji_addr;
 		/* Allocate a new rgd entry which includes rg and ri. */
 		rgd = rgrp_insert(&sdp->rgtree, ri_addr);
-- 
1.7.6.5


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]