[ofa-general] Issues with osm_state_mgr.c:__osm_state_mgr_get_remote_port_info()

Sasha Khapyorsky sashak at voltaire.com
Wed Jun 25 05:33:57 PDT 2008


Hi Vincent,

On 13:36 Wed 25 Jun     , Vincent Ficet wrote:
>
> In the file opensm/osm_state_mgr.c, function 
> __osm_state_mgr_get_remote_port_info(), we have the following code:
>
> mad_context.pi_context.port_guid = 
> cl_hton64(osm_physp_get_port_num(p_physp));
>
> The port_guid's type is ib_net64_t, which is OK w.r.t cl_hton64 type cast.
>
> However, the osm_physp_get_port_num() function in include/opensm/osm_port.h 
> is implemented as follows:
>
> static inline uint8_t
> osm_physp_get_port_num(IN const osm_physp_t * const p_physp)
> {
>   CL_ASSERT(p_physp);
>   CL_ASSERT(osm_physp_is_valid(p_physp));
>   return (p_physp->port_num);
> }
>
> And the port_num field in the osm_physp_t is declared as an uint8_t.
>
> Am I right in saying that feeding a port number into 
> mad_context.pi_context.port_guid is incorrect ?

Yes, it is wrong, there should be:

  mad_context.pi_context.port_guid = cl_hton64(p_physp->port_guid);

This function was broken, we didn't see that since it is almost unused
flow (with stable network). Thanks for the finding. Want to post the
patch?

Sasha



More information about the general mailing list