[ofa-general] [PATCH] opensm/osm_sa_lft_record: validate LFT block number

Sasha Khapyorsky sashak at voltaire.com
Sun Jun 29 16:37:31 PDT 2008


Return nothing when block number was specified but not configured in
switch's LFT.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_sa_lft_record.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/opensm/opensm/osm_sa_lft_record.c b/opensm/opensm/osm_sa_lft_record.c
index 71f624e..b67430c 100644
--- a/opensm/opensm/osm_sa_lft_record.c
+++ b/opensm/opensm/osm_sa_lft_record.c
@@ -187,13 +187,14 @@ __osm_lftr_rcv_by_comp_mask(IN cl_map_item_t * const p_map_item,
 	}
 
 	/* now we need to decide which blocks to output */
+	max_block = osm_switch_get_max_block_id_in_use(p_sw);
 	if (comp_mask & IB_LFTR_COMPMASK_BLOCK) {
-		max_block = min_block = cl_ntoh16(p_rcvd_rec->block_num);
-	} else {
-		/* use as many blocks as "in use" */
+		min_block = cl_ntoh16(p_rcvd_rec->block_num);
+		if (min_block > max_block)
+			return;
+		max_block = min_block;
+	} else /* use as many blocks as "in use" */
 		min_block = 0;
-		max_block = osm_switch_get_max_block_id_in_use(p_sw);
-	}
 
 	/* so we can add these blocks one by one ... */
 	for (block = min_block; block <= max_block; block++)
-- 
1.5.5.1.178.g1f811




More information about the general mailing list