From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carlos Maiolino Date: Thu, 11 Aug 2011 16:37:25 -0300 Subject: [Cluster-devel] [PATCH] gfs2_grow: Fix gfs2_grow when only one RG is present Message-ID: <1313091445-7627-1-git-send-email-cmaiolino@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit If there is only one RG in the filesystem gfs2_grow will make a subtraction using a null pointer to check the RG size returning a invalide RG size value. This patch avoid this substraction if there is only one RG in the filesystem. --- gfs2/mkfs/main_grow.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/gfs2/mkfs/main_grow.c b/gfs2/mkfs/main_grow.c index 0eca396..d7a81a3 100644 --- a/gfs2/mkfs/main_grow.c +++ b/gfs2/mkfs/main_grow.c @@ -133,7 +133,11 @@ static void figure_out_rgsize(struct gfs2_sbd *sdp, unsigned int *orgsize) r1 = osi_list_entry(head->next->next, struct rgrp_list, list); r2 = osi_list_entry(head->next->next->next, struct rgrp_list, list); - *orgsize = r2->ri.ri_addr - r1->ri.ri_addr; + if(r2->ri.ri_addr){ + *orgsize = r2->ri.ri_addr - r1->ri.ri_addr; + }else{ + *orgsize = r1->ri.ri_addr; + } } /** -- 1.7.5.2