cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Carlos Maiolino <cmaiolino@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH] gfs2_grow: Fix gfs2_grow when only one RG is present
Date: Thu, 11 Aug 2011 16:37:25 -0300	[thread overview]
Message-ID: <1313091445-7627-1-git-send-email-cmaiolino@redhat.com> (raw)

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



             reply	other threads:[~2011-08-11 19:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-11 19:37 Carlos Maiolino [this message]
2011-08-12  8:53 ` [Cluster-devel] [PATCH] gfs2_grow: Fix gfs2_grow when only one RG is present Steven Whitehouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1313091445-7627-1-git-send-email-cmaiolino@redhat.com \
    --to=cmaiolino@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).