public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libmlx4: Fix a compiler warning
@ 2011-10-10 17:47 Bart Van Assche
       [not found] ` <201110101947.34035.bvanassche-HInyCGIudOg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Bart Van Assche @ 2011-10-10 17:47 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Roland Dreier

Avoid that link_local_gid() triggers the following compiler warning:
dereferencing type-punned pointer will break strict-aliasing rules

Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>

---
 src/verbs.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/verbs.c b/src/verbs.c
index 199d107..28d8585 100644
--- a/src/verbs.c
+++ b/src/verbs.c
@@ -616,12 +616,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);
-	if (hi == htonl(0xfe800000) && lo == 0)
-		return 1;
+	uint32_t hi = gid->u32[0];
+	uint32_t lo = gid->u32[1];
 
-	return 0;
+	return hi == htonl(0xfe800000) && lo == 0;
 }
 
 static uint16_t get_vlan_id(union ibv_gid *gid)
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-02 15:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-10 17:47 [PATCH] libmlx4: Fix a compiler warning Bart Van Assche
     [not found] ` <201110101947.34035.bvanassche-HInyCGIudOg@public.gmane.org>
2011-10-11  0:41   ` Roland Dreier
     [not found]     ` <CAL1RGDVNoh1Fdm5pvDaeB9YykRpfXMe-s+P_iHs=8Z_r5_DpBQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-04-01 19:09       ` Bart Van Assche
     [not found]         ` <4F78A7F2.7020903-HInyCGIudOg@public.gmane.org>
2012-04-02 15:56           ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox