cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Steven Whitehouse <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] gfs2_edit: Fix bitmap editing function
Date: Tue, 26 Oct 2010 16:53:30 +0100	[thread overview]
Message-ID: <1288108410.2480.7.camel@dolmen> (raw)


The bitmap editing function wasn't reading in the rgrp, so that it
would fail with a NULL pointer dereference.

Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index c1c7512..80cbd26 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -2564,23 +2564,23 @@ static void find_change_block_alloc(int *newval)
 	if (ablock == sbd.sb_addr)
 		printf("3 (the superblock is not in the bitmap)\n");
 	else {
-		if (newval) {
-			if (gfs2_set_bitmap(&sbd, ablock, *newval))
-				printf("-1 (block invalid or part of an rgrp).\n");
-			else
-				printf("%d\n", *newval);
-		} else {
-			rgd = gfs2_blk2rgrpd(&sbd, ablock);
-			if (rgd) {
-				gfs2_rgrp_read(&sbd, rgd);
+		rgd = gfs2_blk2rgrpd(&sbd, ablock);
+		if (rgd) {
+			gfs2_rgrp_read(&sbd, rgd);
+			if (newval) {
+				if (gfs2_set_bitmap(&sbd, ablock, *newval))
+					printf("-1 (block invalid or part of an rgrp).\n");
+				else
+					printf("%d\n", *newval);
+			} else {
 				type = gfs2_get_bitmap(&sbd, ablock, rgd);
-				gfs2_rgrp_relse(rgd);
 				printf("%d (%s)\n", type, allocdesc[gfs1][type]);
-			} else {
-				gfs2_rgrp_free(&sbd.rglist);
-				printf("-1 (block invalid or part of an rgrp).\n");
-				exit(-1);
 			}
+			gfs2_rgrp_relse(rgd);
+		} else {
+			gfs2_rgrp_free(&sbd.rglist);
+			printf("-1 (block invalid or part of an rgrp).\n");
+			exit(-1);
 		}
 	}
 	gfs2_rgrp_free(&sbd.rglist);




                 reply	other threads:[~2010-10-26 15:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1288108410.2480.7.camel@dolmen \
    --to=swhiteho@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).