Patchwork [8/8] e2fsck/jfs_user.h: Fix b_data alignment in struct buffer_head

login
register
mail settings
Submitter Sami Liedes
Date Dec. 13, 2012, 10:04 p.m.
Message ID <20121213220433.GP9713@sli.dy.fi>
Download mbox | patch
Permalink /patch/206257/
State New
Headers show

Comments

Sami Liedes - Dec. 13, 2012, 10:04 p.m.
buffer_head.b_data needs to be 8-byte aligned to prevent an unaligned
access via a 64-bit pointer in e.g. scan_revoke_records().

Caught using clang -fsanitize=undefined.

Signed-off-by: Sami Liedes <sami.liedes@iki.fi>
---
 e2fsck/jfs_user.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/e2fsck/jfs_user.h b/e2fsck/jfs_user.h
index 3cccd3f..fdaf1b2 100644
--- a/e2fsck/jfs_user.h
+++ b/e2fsck/jfs_user.h
@@ -22,7 +22,7 @@  struct buffer_head {
 	int	 	b_dirty;
 	int	 	b_uptodate;
 	int	 	b_err;
-	char		b_data[1024];
+	char		b_data[1024]  __attribute__ ((aligned (8)));
 };
 
 struct inode {