[ofa-general] ***SPAM*** Re: [PATCH] Enhance min hops counters in Ftree

Nicolas Morey-Chaisemartin devel-ofed at morey-chaisemartin.com
Tue Apr 14 01:23:03 PDT 2009


Le 14/04/2009 10:08, Sasha Khapyorsky a écrit :
>>   /***************************************************
>> @@ -553,6 +554,9 @@ static ftree_sw_t *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->hops =
>> +	    malloc(cl_ntoh16(p_osm_sw->max_lid_ho) * sizeof(*(p_sw->hops)));
>> +	memset(p_sw->hops, OSM_NO_PATH, cl_ntoh16(p_osm_sw->max_lid_ho));
>
> AFAIR p_osm_sw->max_lid_ho is already in host byte order and cl_ntoh16()
> should swap bytes, how then did it work?

This is actually a bug. In my tests it seemed I always hat network order value > host order value so it worked.
I'm fixing this.
>
> Also malloc() may fail and return value check is needed.
I'll had this too.

Anyway I have to rewrite few things due to the last patch from Yevgeny which changes usage with network/host order.

Nicolas



More information about the general mailing list