File libmlx4-fix_type_punning.patch of Package libmlx4-rdmav2

---
 src/qp.c    |    3 ++-
 src/verbs.c |    6 ++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

Index: src/qp.c
===================================================================
--- src/qp.c.orig	2013-04-03 20:34:11.000000000 +0200
+++ src/qp.c	2014-01-21 20:15:55.762472770 +0100
@@ -403,8 +403,9 @@ out:
 	ctx = to_mctx(ibqp->context);
 
 	if (nreq == 1 && inl && size > 1 && size <= ctx->bf_buf_size / 16) {
+	        union{ uint8_t *ui8p; uint32_t *ui32p; }pun = { ctrl->reserved };
 		ctrl->owner_opcode |= htonl((qp->sq.head & 0xffff) << 8);
-		*(uint32_t *) ctrl->reserved |= qp->doorbell_qpn;
+		 *pun.ui32p |= qp->doorbell_qpn;
 		/*
 		 * Make sure that descriptor is written to memory
 		 * before writing to BlueFlame page.
Index: src/verbs.c
===================================================================
--- src/verbs.c.orig	2013-04-03 20:21:48.000000000 +0200
+++ src/verbs.c	2014-01-21 20:17:45.631928219 +0100
@@ -628,8 +628,10 @@ int mlx4_destroy_qp(struct ibv_qp *ibqp)
 
 static int link_local_gid(const union ibv_gid *gid)
 {
-	uint32_t hi = *(uint32_t *)(gid->raw);
-	uint32_t lo = *(uint32_t *)(gid->raw + 4);
+	uint32_t hi, lo;
+	memcpy(&hi, gid->raw, sizeof(uint32_t));
+	memcpy(&lo, gid->raw + 4, sizeof(uint32_t));
+
 	if (hi == htonl(0xfe800000) && lo == 0)
 		return 1;