All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
Subject: [PATCH] libmlx4: Fix a compiler warning
Date: Mon, 10 Oct 2011 19:47:33 +0200	[thread overview]
Message-ID: <201110101947.34035.bvanassche@acm.org> (raw)

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

             reply	other threads:[~2011-10-10 17:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-10 17:47 Bart Van Assche [this message]
     [not found] ` <201110101947.34035.bvanassche-HInyCGIudOg@public.gmane.org>
2011-10-11  0:41   ` [PATCH] libmlx4: Fix a compiler warning 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201110101947.34035.bvanassche@acm.org \
    --to=bvanassche-hinycgiudog@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.