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

Sasha Khapyorsky sashak at voltaire.com
Wed Jan 9 11:41:53 PST 2008


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) {
-- 
1.5.4.rc2.38.gd6da3




More information about the general mailing list