diff mbox

include/rdma/opa_addr.h: Fix an endianness issue

Message ID 20180702170651.9062-1-bart.vanassche@wdc.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show

Commit Message

Bart Van Assche July 2, 2018, 5:06 p.m. UTC
IB_MULTICAST_LID_BASE is defined as follows:

  #define IB_MULTICAST_LID_BASE   cpu_to_be16(0xC000)

Hence use be16_to_cpu() to convert it to CPU endianness.
Compile-tested only.

Fixes: af808ece5ce9 ("IB/SA: Check dlid before SA agent queries for ClassPortInfo")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Venkata Sandeep Dhanalakota <venkata.s.dhanalakota@intel.com>
Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>
Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
---
 include/rdma/opa_addr.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jason Gunthorpe July 3, 2018, 8:11 p.m. UTC | #1
On Mon, Jul 02, 2018 at 10:06:51AM -0700, Bart Van Assche wrote:
> IB_MULTICAST_LID_BASE is defined as follows:
> 
>   #define IB_MULTICAST_LID_BASE   cpu_to_be16(0xC000)
> 
> Hence use be16_to_cpu() to convert it to CPU endianness.
> Compile-tested only.
> 
> Fixes: af808ece5ce9 ("IB/SA: Check dlid before SA agent queries for ClassPortInfo")
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Venkata Sandeep Dhanalakota <venkata.s.dhanalakota@intel.com>
> Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>
> Cc: Dennis Dalessandro <dennis.dalessandro@intel.com>
>  include/rdma/opa_addr.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/rdma/opa_addr.h b/include/rdma/opa_addr.h
> index 2bbb7a67e643..66d4393d339c 100644
> +++ b/include/rdma/opa_addr.h
> @@ -120,7 +120,7 @@ static inline bool rdma_is_valid_unicast_lid(struct rdma_ah_attr *attr)
>  	if (attr->type == RDMA_AH_ATTR_TYPE_IB) {
>  		if (!rdma_ah_get_dlid(attr) ||
>  		    rdma_ah_get_dlid(attr) >=
> -		    be32_to_cpu(IB_MULTICAST_LID_BASE))
> +		    be16_to_cpu(IB_MULTICAST_LID_BASE))
>  			return false;
>  	} else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) {
>  		if (!rdma_ah_get_dlid(attr) ||

Why is this function in a file called opa_addr.h?

Otherwise applied to -next, doesn't really look like it is triggerable..

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

Patch

diff --git a/include/rdma/opa_addr.h b/include/rdma/opa_addr.h
index 2bbb7a67e643..66d4393d339c 100644
--- a/include/rdma/opa_addr.h
+++ b/include/rdma/opa_addr.h
@@ -120,7 +120,7 @@  static inline bool rdma_is_valid_unicast_lid(struct rdma_ah_attr *attr)
 	if (attr->type == RDMA_AH_ATTR_TYPE_IB) {
 		if (!rdma_ah_get_dlid(attr) ||
 		    rdma_ah_get_dlid(attr) >=
-		    be32_to_cpu(IB_MULTICAST_LID_BASE))
+		    be16_to_cpu(IB_MULTICAST_LID_BASE))
 			return false;
 	} else if (attr->type == RDMA_AH_ATTR_TYPE_OPA) {
 		if (!rdma_ah_get_dlid(attr) ||