aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@mellanox.co.il>2006-07-14 03:23:52 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-07-15 00:53:50 -0400
commitf0ee3404cce2c45f8b95b341dd6311cd92e5cee0 (patch)
treefc4a88c79310ea1937c6ede58c0a06f5b056078a /include/rdma
parent04c335430f6d9f9088c852bc05a3a0c8baa921c4 (diff)
[PATCH] IB/addr: gid structure alignment fix
The device address contains unsigned character arrays, which contain raw GID addresses. The GIDs may not be naturally aligned, so do not cast them to structures or unions. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il> Cc: Roland Dreier <rolandd@cisco.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/rdma')
-rw-r--r--include/rdma/ib_addr.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index fcb5ba87dcc5..0ff67398928d 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -89,9 +89,10 @@ static inline void ib_addr_set_pkey(struct rdma_dev_addr *dev_addr, u16 pkey)
89 dev_addr->broadcast[9] = (unsigned char) pkey; 89 dev_addr->broadcast[9] = (unsigned char) pkey;
90} 90}
91 91
92static inline union ib_gid *ib_addr_get_sgid(struct rdma_dev_addr *dev_addr) 92static inline void ib_addr_get_sgid(struct rdma_dev_addr *dev_addr,
93 union ib_gid *gid)
93{ 94{
94 return (union ib_gid *) (dev_addr->src_dev_addr + 4); 95 memcpy(gid, dev_addr->src_dev_addr + 4, sizeof *gid);
95} 96}
96 97
97static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr, 98static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr,
@@ -100,9 +101,10 @@ static inline void ib_addr_set_sgid(struct rdma_dev_addr *dev_addr,
100 memcpy(dev_addr->src_dev_addr + 4, gid, sizeof *gid); 101 memcpy(dev_addr->src_dev_addr + 4, gid, sizeof *gid);
101} 102}
102 103
103static inline union ib_gid *ib_addr_get_dgid(struct rdma_dev_addr *dev_addr) 104static inline void ib_addr_get_dgid(struct rdma_dev_addr *dev_addr,
105 union ib_gid *gid)
104{ 106{
105 return (union ib_gid *) (dev_addr->dst_dev_addr + 4); 107 memcpy(gid, dev_addr->dst_dev_addr + 4, sizeof *gid);
106} 108}
107 109
108static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr, 110static inline void ib_addr_set_dgid(struct rdma_dev_addr *dev_addr,