diff mbox

[01/47] IB/core: Fix endianness annotation in rdma_is_multicast_addr()

Message ID 20171006213333.6721-2-bart.vanassche@wdc.com (mailing list archive)
State Superseded
Headers show

Commit Message

Bart Van Assche Oct. 6, 2017, 9:32 p.m. UTC
Since ipv4_addr is a big endian 32-bit number, annotate it as such.

Fixes: commit be1d325a3358 ("IB/core: Set RoCEv2 MGID according to spec")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
---
 include/rdma/ib_addr.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Leon Romanovsky Oct. 8, 2017, 1:50 p.m. UTC | #1
On Fri, Oct 06, 2017 at 02:32:47PM -0700, Bart Van Assche wrote:
> Since ipv4_addr is a big endian 32-bit number, annotate it as such.
>
> Fixes: commit be1d325a3358 ("IB/core: Set RoCEv2 MGID according to spec")
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> ---
>  include/rdma/ib_addr.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
diff mbox

Patch

diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h
index ec5008cf5d51..cfa82d16573d 100644
--- a/include/rdma/ib_addr.h
+++ b/include/rdma/ib_addr.h
@@ -305,12 +305,12 @@  static inline void rdma_get_ll_mac(struct in6_addr *addr, u8 *mac)
 
 static inline int rdma_is_multicast_addr(struct in6_addr *addr)
 {
-	u32 ipv4_addr;
+	__be32 ipv4_addr;
 
 	if (addr->s6_addr[0] == 0xff)
 		return 1;
 
-	memcpy(&ipv4_addr, addr->s6_addr + 12, 4);
+	ipv4_addr = addr->s6_addr32[3];
 	return (ipv6_addr_v4mapped(addr) && ipv4_is_multicast(ipv4_addr));
 }