diff mbox

Fixes wrong assertion failed in osm_switch_get_lft_block()

Message ID 5495BE60.50301@simula.no (mailing list archive)
State Accepted
Delegated to: Hal Rosenstock
Headers show

Commit Message

Vangelis Tasoulas Dec. 20, 2014, 6:22 p.m. UTC
From a399cd7398a86b72541c628588365c252882cd80 Mon Sep 17 00:00:00 2001
From: Vangelis Tasoulas <vangelis@tasoulas.net>
Date: Sat, 20 Dec 2014 19:10:33 +0100
Subject: [PATCH] Fixes wrong assertion failed in osm_switch_get_lft_block()
 when LIDs from the top LFT block (0xbfc0-0xbfff) are used.

---
 opensm/osm_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

        return TRUE;
 }

Comments

Ilya Nelkenbaum Dec. 21, 2014, 10:07 a.m. UTC | #1
On 12/20/2014 8:22 PM, Vangelis Tasoulas wrote:
> From a399cd7398a86b72541c628588365c252882cd80 Mon Sep 17 00:00:00 2001
> From: Vangelis Tasoulas <vangelis@tasoulas.net>
> Date: Sat, 20 Dec 2014 19:10:33 +0100
> Subject: [PATCH] Fixes wrong assertion failed in osm_switch_get_lft_block()
>  when LIDs from the top LFT block (0xbfc0-0xbfff) are used.
> 
> ---
>  opensm/osm_switch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/opensm/osm_switch.c b/opensm/osm_switch.c
> index 11efd54..a28ec28 100644
> --- a/opensm/osm_switch.c
> +++ b/opensm/osm_switch.c
> @@ -168,7 +168,7 @@ boolean_t osm_switch_get_lft_block(IN const
> osm_switch_t * p_sw,
>         if (base_lid_ho > p_sw->max_lid_ho)
>                 return FALSE;
> 
> -       CL_ASSERT(base_lid_ho + IB_SMP_DATA_SIZE <= IB_LID_UCAST_END_HO);
> +       CL_ASSERT(base_lid_ho + IB_SMP_DATA_SIZE - 1 <=
> IB_LID_UCAST_END_HO);
What about using IB_LID_MCAST_START_HO (49152) instead of IB_LID_UCAST_END_HO (49151)?
No additional arithemtic will be needed then.

>         memcpy(p_block, &(p_sw->lft[base_lid_ho]), IB_SMP_DATA_SIZE);
>         return TRUE;
>  }
> 

--
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
Vangelis Tasoulas Dec. 21, 2014, 1:50 p.m. UTC | #2
On 12/21/2014 11:07 AM, Ilya Nelkenbaum wrote:
> On 12/20/2014 8:22 PM, Vangelis Tasoulas wrote:
>> From a399cd7398a86b72541c628588365c252882cd80 Mon Sep 17 00:00:00 2001
>> From: Vangelis Tasoulas <vangelis@tasoulas.net>
>> Date: Sat, 20 Dec 2014 19:10:33 +0100
>> Subject: [PATCH] Fixes wrong assertion failed in osm_switch_get_lft_block()
>>  when LIDs from the top LFT block (0xbfc0-0xbfff) are used.
>>
>> ---
>>  opensm/osm_switch.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/opensm/osm_switch.c b/opensm/osm_switch.c
>> index 11efd54..a28ec28 100644
>> --- a/opensm/osm_switch.c
>> +++ b/opensm/osm_switch.c
>> @@ -168,7 +168,7 @@ boolean_t osm_switch_get_lft_block(IN const
>> osm_switch_t * p_sw,
>>         if (base_lid_ho > p_sw->max_lid_ho)
>>                 return FALSE;
>>
>> -       CL_ASSERT(base_lid_ho + IB_SMP_DATA_SIZE <= IB_LID_UCAST_END_HO);
>> +       CL_ASSERT(base_lid_ho + IB_SMP_DATA_SIZE - 1 <=
>> IB_LID_UCAST_END_HO);
> What about using IB_LID_MCAST_START_HO (49152) instead of IB_LID_UCAST_END_HO (49151)?
> No additional arithemtic will be needed then.

This function is about the LFTs and not the MFTs, so having '<=
IB_LID_MCAST_START_HO' would look a bit confusing -at least to me- at a
first glance due to the equal sign.

Less or equal to the first mcast LID? I understand the less, but why equal?

> 
>>         memcpy(p_block, &(p_sw->lft[base_lid_ho]), IB_SMP_DATA_SIZE);
>>         return TRUE;
>>  }
>>
>
Ilya Nelkenbaum Dec. 21, 2014, 2:02 p.m. UTC | #3
On 12/21/2014 3:50 PM, Vangelis Tasoulas wrote:
> On 12/21/2014 11:07 AM, Ilya Nelkenbaum wrote:
>> On 12/20/2014 8:22 PM, Vangelis Tasoulas wrote:
>>> From a399cd7398a86b72541c628588365c252882cd80 Mon Sep 17 00:00:00 2001
>>> From: Vangelis Tasoulas <vangelis@tasoulas.net>
>>> Date: Sat, 20 Dec 2014 19:10:33 +0100
>>> Subject: [PATCH] Fixes wrong assertion failed in osm_switch_get_lft_block()
>>>  when LIDs from the top LFT block (0xbfc0-0xbfff) are used.
>>>
>>> ---
>>>  opensm/osm_switch.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/opensm/osm_switch.c b/opensm/osm_switch.c
>>> index 11efd54..a28ec28 100644
>>> --- a/opensm/osm_switch.c
>>> +++ b/opensm/osm_switch.c
>>> @@ -168,7 +168,7 @@ boolean_t osm_switch_get_lft_block(IN const
>>> osm_switch_t * p_sw,
>>>         if (base_lid_ho > p_sw->max_lid_ho)
>>>                 return FALSE;
>>>
>>> -       CL_ASSERT(base_lid_ho + IB_SMP_DATA_SIZE <= IB_LID_UCAST_END_HO);
>>> +       CL_ASSERT(base_lid_ho + IB_SMP_DATA_SIZE - 1 <=
>>> IB_LID_UCAST_END_HO);
>> What about using IB_LID_MCAST_START_HO (49152) instead of IB_LID_UCAST_END_HO (49151)?
>> No additional arithemtic will be needed then.
> 
> This function is about the LFTs and not the MFTs, so having '<=
> IB_LID_MCAST_START_HO' would look a bit confusing -at least to me- at a
> first glance due to the equal sign.
Sounds reasonable.

> 
> Less or equal to the first mcast LID? I understand the less, but why equal?
> 
>>
>>>         memcpy(p_block, &(p_sw->lft[base_lid_ho]), IB_SMP_DATA_SIZE);
>>>         return TRUE;
>>>  }
>>>
>>
> 
> 

--
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
Hal Rosenstock Jan. 2, 2015, 1:25 p.m. UTC | #4
On 12/20/2014 1:22 PM, Vangelis Tasoulas wrote:
> From a399cd7398a86b72541c628588365c252882cd80 Mon Sep 17 00:00:00 2001
> From: Vangelis Tasoulas <vangelis@tasoulas.net>
> Date: Sat, 20 Dec 2014 19:10:33 +0100
> Subject: [PATCH] Fixes wrong assertion failed in osm_switch_get_lft_block()
>  when LIDs from the top LFT block (0xbfc0-0xbfff) are used.

Thanks. Applied.

-- Hal
--
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

From a399cd7398a86b72541c628588365c252882cd80 Mon Sep 17 00:00:00 2001
From: Vangelis Tasoulas <vangelis@tasoulas.net>
Date: Sat, 20 Dec 2014 19:10:33 +0100
Subject: [PATCH] Fixes wrong assertion failed in osm_switch_get_lft_block()
 when LIDs from the top LFT block (0xbfc0-0xbfff) are used.

---
 opensm/osm_switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/opensm/osm_switch.c b/opensm/osm_switch.c
index 11efd54..a28ec28 100644
--- a/opensm/osm_switch.c
+++ b/opensm/osm_switch.c
@@ -168,7 +168,7 @@  boolean_t osm_switch_get_lft_block(IN const osm_switch_t * p_sw,
 	if (base_lid_ho > p_sw->max_lid_ho)
 		return FALSE;
 
-	CL_ASSERT(base_lid_ho + IB_SMP_DATA_SIZE <= IB_LID_UCAST_END_HO);
+	CL_ASSERT(base_lid_ho + IB_SMP_DATA_SIZE - 1 <= IB_LID_UCAST_END_HO);
 	memcpy(p_block, &(p_sw->lft[base_lid_ho]), IB_SMP_DATA_SIZE);
 	return TRUE;
 }
-- 
1.9.1