* [Cluster-devel] gfs2_edit: Fix bitmap editing function
@ 2010-10-26 15:53 Steven Whitehouse
0 siblings, 0 replies; only message in thread
From: Steven Whitehouse @ 2010-10-26 15:53 UTC (permalink / raw)
To: cluster-devel.redhat.com
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);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-10-26 15:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-26 15:53 [Cluster-devel] gfs2_edit: Fix bitmap editing function Steven Whitehouse
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).