crfsdctl: fix unaligned access fault in pr_hello

Alex Chiang achiang at hp.com
Fri May 2 14:20:18 PDT 2008


* Zach Brown <zach.brown at oracle.com>:
> Alex Chiang wrote:
> > 
> > Not sure how much we care about this, but I get at least one
> > unaligned access warning while running crfsdctl snoop:
> 
> We certainly care about this.  Thanks for testing on a platform which
> whines about this ;).

ia64 /is/ useful. ;)

> > Here's a patch that fixes it -- there are definitely more clever
> > ways to do this
> 
> How about just slapping __attribute__((packed)) on struct crfs_msg_hello?

Yep, you're right, much simpler. :)

/ac

From: Alex Chiang <achiang at hp.com>
Subject: crfsdctl: fix unaligned access fault in pr_hello

Add __attribute__((packed)) to struct crfs_msg_hello to prevent
unaligned access faults, especially in crfsdctl.

Signed-off-by: Alex Chiang <achiang at hp.com>

diff -r 77848719c4ba include/crfs-shared/wire.h
--- a/include/crfs-shared/wire.h	Tue Apr 22 14:03:17 2008 -0700
+++ b/include/crfs-shared/wire.h	Fri May 02 15:14:59 2008 -0600
@@ -168,7 +168,7 @@ enum {
 
 struct crfs_msg_hello {
 	be32	ver;
-};
+} __attribute__((packed));
 
 struct crfs_msg_item_query {
 	struct crfs_key	key;



More information about the crfs-devel mailing list