This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: RHEL55 - gfs2_edit produces unaligned access


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=93cd1d93eadd44ea67ff4a2e486564c0254a1105
Commit:        93cd1d93eadd44ea67ff4a2e486564c0254a1105
Parent:        e569d4f226eb860d7bda5198a014f249a02ba6af
Author:        Bob Peterson <rpeterso@redhat.com>
AuthorDate:    Sat Jul 18 22:44:31 2009 -0500
Committer:     Bob Peterson <rpeterso@redhat.com>
CommitterDate: Mon Aug 17 10:53:48 2009 -0500

gfs2_edit produces unaligned access

This patch fixes a problem whereby gfs2_edit would give
"unaligned access" errors on some architectures.

rhbz#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 38274c2..5937663 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -872,9 +872,8 @@ void rgcount(void)
 /* ------------------------------------------------------------------------ */
 uint64_t find_rgrp_block(struct gfs2_inode *di, int rg)
 {
-	char buf[sizeof(struct gfs2_rindex)];
 	int amt;
-	struct gfs2_rindex ri;
+	struct gfs2_rindex buf, ri;
 	uint64_t offset, gfs1_adj = 0;
 
 	offset = rg * risize();
@@ -889,7 +888,7 @@ uint64_t find_rgrp_block(struct gfs2_inode *di, int rg)
 	amt = gfs2_readi(di, (void *)&buf, offset + gfs1_adj, risize());
 	if (!amt) /* end of file */
 		return 0;
-	gfs2_rindex_in(&ri, buf);
+	gfs2_rindex_in(&ri, (void *)&buf);
 	return ri.ri_addr;
 }
 
diff --git a/gfs2/edit/savemeta.c b/gfs2/edit/savemeta.c
index dea57cb..4559f6d 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -66,12 +66,13 @@ uint64_t masterblock(const char *fn);
  */
 int get_gfs_struct_info(char *buf, int *block_type, int *struct_len)
 {
-	struct gfs2_meta_header mh;
+	struct gfs2_meta_header mh, mhbuf;
 
 	*block_type = 0;
 	*struct_len = sbd.bsize;
 
-	gfs2_meta_header_in(&mh, buf);
+	memcpy(&mhbuf, buf, sizeof(mhbuf));
+	gfs2_meta_header_in(&mh, (void *)&mhbuf);
 	if (mh.mh_magic != GFS2_MAGIC)
 		return -1;
 
@@ -710,7 +711,10 @@ int restore_data(int fd, int in_fd, int printblocksonly)
 				do_read(in_fd, savedata->buf,
 					savedata->siglen);
 			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 ==


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]