[ofa-general] Re: [PATCH] opensm/osm_sa_slvl_record: fix overflow crash

Hal Rosenstock hrosenstock at xsigo.com
Thu Jan 10 07:24:45 PST 2008


Sasha,

On Wed, 2008-01-09 at 19:41 +0000, Sasha Khapyorsky wrote:
> When SL2VLTableRecord is requested for switch by lid only (no in and out
> ports are selected in compmask) it overflows its own physical ports
> table.
> 
> Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
> ---
>  opensm/opensm/osm_sa_slvl_record.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/opensm/opensm/osm_sa_slvl_record.c b/opensm/opensm/osm_sa_slvl_record.c
> index 28dddd4..cc21765 100644
> --- a/opensm/opensm/osm_sa_slvl_record.c
> +++ b/opensm/opensm/osm_sa_slvl_record.c
> @@ -149,9 +149,9 @@ __osm_sa_slvl_by_comp_mask(IN osm_sa_t * sa,
>  	comp_mask = p_ctxt->comp_mask;
>  	num_ports = osm_node_get_num_physp(p_port->p_node);
>  	in_port_start = 0;
> -	in_port_end = num_ports;
> +	in_port_end = num_ports - 1;
>  	out_port_start = 0;
> -	out_port_end = num_ports;
> +	out_port_end = num_ports - 1;
>  	p_req_physp = p_ctxt->p_req_physp;
>  
>  	if (p_port->p_node->node_info.node_type != IB_NODE_TYPE_SWITCH) {

Minor comment:
Rather than subtracting 1 from in/out_port_end, wouldn't changing the
input and output port number comparisons to < rather than <= work (and
be more consistent with other SA record handling) ?

-- Hal




More information about the general mailing list