[openib-general] [PATCH] IB/core: fix ib_umad alignment fault on ia64

Michael S. Tsirkin mst at mellanox.co.il
Mon Jan 22 01:04:14 PST 2007


From: Jason Gunthorpe <jgunthorpe at obsidianresearch.com>

Make the untyped data region in ib_user_mad u64 aligned so that casting
ib_user_mad data to structs with u64s in them is safe on 64 bit platforms.

Note this does not affect the ABI - ib_user_mad format stays the same,
the only effect this has is in how ib_user_mad is placed within larger
kernel-only structures.

Signed-off-by: Jason Gunthorpe <jgunthorpe at obsidianresearch.com>
Acked-by: Michael S. Tsirkin <mst at mellanox.co.il>

---

Works fine for me, and while this mainly removes an annoying message
from kernel log on ia64, I think this is safe enough to be 2.6.20 material.
Further, compiler has right to assume a structure with a 64 bit field
is naturally aligned on a 64 bit platform, so current code might
thinkably trigger incorrect code to be generated with e.g. memcpy
(never observed this in practice though).

Roland, could you queue this please?

diff --git a/include/rdma/ib_user_mad.h b/include/rdma/ib_user_mad.h
index 44537aa..d66b15e 100644
--- a/include/rdma/ib_user_mad.h
+++ b/include/rdma/ib_user_mad.h
@@ -98,7 +98,7 @@ struct ib_user_mad_hdr {
  */
 struct ib_user_mad {
 	struct ib_user_mad_hdr hdr;
-	__u8	data[0];
+	__u64	data[0];
 };
 
 /**


-- 
MST




More information about the general mailing list