public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - gfs2_edit produces unaligned access
@ 2009-07-19  4:43 Bob Peterson
  0 siblings, 0 replies; only message in thread
From: Bob Peterson @ 2009-07-19  4:43 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=abfc1f6194474c3d218e340c7c3bf1a8d246fcdb
Commit:        abfc1f6194474c3d218e340c7c3bf1a8d246fcdb
Parent:        8b932966fd7407b85b0b34ca71cb7471bbef8078
Author:        Bob Peterson <rpeterso@redhat.com>
AuthorDate:    Sat Jul 18 23:37:15 2009 -0500
Committer:     Bob Peterson <rpeterso@redhat.com>
CommitterDate: Sat Jul 18 23:37:15 2009 -0500

gfs2_edit produces unaligned access

bz 503530
---
 gfs2/edit/hexedit.c  |    5 ++---
 gfs2/edit/savemeta.c |   10 +++++++---
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/gfs2/edit/hexedit.c b/gfs2/edit/hexedit.c
index b774ead..ff449e9 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -798,9 +798,8 @@ static void rgcount(void)
 /* ------------------------------------------------------------------------ */
 static uint64_t find_rgrp_block(struct gfs2_inode *dif, int rg)
 {
-	char fbuf[sizeof(struct gfs2_rindex)];
 	int amt;
-	struct gfs2_rindex ri;
+	struct gfs2_rindex fbuf, ri;
 	uint64_t foffset, gfs1_adj = 0;
 
 	foffset = rg * risize();
@@ -815,7 +814,7 @@ static uint64_t find_rgrp_block(struct gfs2_inode *dif, int rg)
 	amt = gfs2_readi(dif, (void *)&fbuf, foffset + gfs1_adj, risize());
 	if (!amt) /* end of file */
 		return 0;
-	gfs2_rindex_in(&ri, fbuf);
+	gfs2_rindex_in(&ri, (void *)&fbuf);
 	return ri.ri_addr;
 }
 
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index ee5ff04..243ee49 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -52,12 +52,13 @@ extern void read_superblock(void);
  */
 static int get_gfs_struct_info(char *gbuf, int *block_type, int *gstruct_len)
 {
-	struct gfs2_meta_header mh;
+	struct gfs2_meta_header mh, mhbuf;
 
 	*block_type = 0;
 	*gstruct_len = sbd.bsize;
 
-	gfs2_meta_header_in(&mh, gbuf);
+	memcpy(&mhbuf, gbuf, sizeof(mhbuf));
+	gfs2_meta_header_in(&mh, (void *)&mhbuf);
 	if (mh.mh_magic != GFS2_MAGIC)
 		return -1;
 
@@ -782,7 +783,10 @@ static int restore_data(int fd, int in_fd, int printblocksonly)
 				exit(-1);
 			}
 			if (first) {
-				gfs2_sb_in(&sbd.sd_sb, savedata->buf);
+				struct gfs2_sb bufsb;
+
+				memcpy(&bufsb, savedata->buf, sizeof(bufsb));
+				gfs2_sb_in(&sbd.sd_sb, (void *)&bufsb);
 				sbd1 = (struct gfs_sb *)&sbd.sd_sb;
 				if (sbd1->sb_fs_format == GFS_FORMAT_FS &&
 				    sbd1->sb_header.mh_type ==


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-19  4:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-19  4:43 cluster: STABLE3 - gfs2_edit produces unaligned access Bob Peterson

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 read-only IMAP folder(s) and NNTP newsgroup(s).