[ofa-general] [PATCH] opensm/osm_ucast_ftree.c Fixed bad init value for down port index

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Tue Feb 10 00:59:31 PST 2009


Hi Nicolas,

Nicolas Morey Chaisemartin wrote:
> We have to add the module value to the index before actually doing the 
> module, or we get a value of -1 which makes OpenSM segfaults
> 
> Signed-off-by: Nicolas Morey-Chaisemartin 
> <nicolas.morey-chaisemartin at ext.bull.net>
> ---
> 
> I missed this one in my previous patch.  Sorry for that
> 
>  opensm/opensm/osm_ucast_ftree.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> 
> 
> diff --git a/opensm/opensm/osm_ucast_ftree.c b/opensm/opensm/osm_ucast_ftree.c
> index 4e65c87..c8f5f08 100644
> --- a/opensm/opensm/osm_ucast_ftree.c
> +++ b/opensm/opensm/osm_ucast_ftree.c
> @@ -1921,7 +1921,8 @@ __osm_ftree_fabric_route_upgoing_by_going_down(IN ftree_fabric_t * p_ftree,
>  		return FALSE;
>  
>  	/* foreach down-going port group (in indexing order) */
> -	i = p_sw->down_port_groups_idx;
> +	i = (p_sw->down_port_groups_idx +
> +	     p_sw->down_port_groups_num) % p_sw->down_port_groups_num;

Perhaps it would be simpler just to init the down_port_groups_idx to 0 instead of -1?
Something like this:

diff --git a/opensm/opensm/osm_ucast_ftree.c b/opensm/opensm/osm_ucast_ftree.c
index 4e65c87..eae1ed8 100644
--- a/opensm/opensm/osm_ucast_ftree.c
+++ b/opensm/opensm/osm_ucast_ftree.c
@@ -563,7 +563,7 @@ static ftree_sw_t *__osm_ftree_sw_create(IN ftree_fabric_t * p_ftree,
  	/* initialize lft buffer */
  	memset(p_osm_sw->new_lft, OSM_NO_PATH, IB_LID_UCAST_END_HO + 1);

-	p_sw->down_port_groups_idx = -1;
+	p_sw->down_port_groups_idx = 0;

  	return p_sw;
  }				/* __osm_ftree_sw_create() */





More information about the general mailing list