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]

gfs2-utils: master - gfs2_edit produces unaligned access


Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=60d5d7cbd26888177653a766bd476c307b091074
Commit:        60d5d7cbd26888177653a766bd476c307b091074
Parent:        5305e878a987b90caf498f0bc5a92ae7ba8fa57d
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:43:08 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 5c66995..17d8d7d 100644
--- a/gfs2/edit/hexedit.c
+++ b/gfs2/edit/hexedit.c
@@ -800,9 +800,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();
@@ -817,7 +816,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 d1b6984..fd7a29f 100644
--- a/gfs2/edit/savemeta.c
+++ b/gfs2/edit/savemeta.c
@@ -54,12 +54,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;
 
@@ -784,7 +785,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 ==


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