***SPAM*** Re: [ofa-general] [PATCH v2] opensm/osm_mcast_tbl.c wrong max mcast lid cause the sm to set invalid MFT block.

Eli Dorfman dorfman.eli at gmail.com
Sun Nov 16 03:06:17 PST 2008


 wrong max mcast lid cause the sm to set invalid MFT block.
 when mcmember tries to set mcast lid beyond mcast capability (e.g. 0xc400),
 the sm accepts this and tries to set invalid block.

 Signed-off-by: Eli Dorfman <elid at voltaire.com>

---
 opensm/opensm/osm_mcast_tbl.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/opensm/opensm/osm_mcast_tbl.c b/opensm/opensm/osm_mcast_tbl.c
index 92fbb63..17fb69c 100644
--- a/opensm/opensm/osm_mcast_tbl.c
+++ b/opensm/opensm/osm_mcast_tbl.c
@@ -81,7 +81,7 @@ osm_mcast_tbl_init(IN osm_mcast_tbl_t * const p_tbl,
 						IB_MCAST_BLOCK_SIZE) /
 					IB_MCAST_BLOCK_SIZE) - 1);
 
-	p_tbl->max_mlid_ho = (uint16_t) (IB_LID_MCAST_START_HO + capacity);
+	p_tbl->max_mlid_ho = (uint16_t) (IB_LID_MCAST_START_HO + capacity - 1);
 
 	/*
 	   The number of bytes needed in the mask table is:
@@ -216,7 +216,7 @@ osm_mcast_tbl_set_block(IN osm_mcast_tbl_t * const p_tbl,
 
 	mlid_start_ho = (uint16_t) (block_num * IB_MCAST_BLOCK_SIZE);
 
-	if (mlid_start_ho + IB_MCAST_BLOCK_SIZE > p_tbl->max_mlid_ho)
+	if (mlid_start_ho + IB_MCAST_BLOCK_SIZE - 1 > p_tbl->max_mlid_ho)
 		return (IB_INVALID_PARAMETER);
 
 	for (i = 0; i < IB_MCAST_BLOCK_SIZE; i++)
@@ -274,7 +274,7 @@ osm_mcast_tbl_get_block(IN osm_mcast_tbl_t * const p_tbl,
 
 	mlid_start_ho = (uint16_t) (block_num * IB_MCAST_BLOCK_SIZE);
 
-	if (mlid_start_ho + IB_MCAST_BLOCK_SIZE > p_tbl->max_mlid_ho)
+	if (mlid_start_ho + IB_MCAST_BLOCK_SIZE - 1 > p_tbl->max_mlid_ho)
 		return (IB_INVALID_PARAMETER);
 
 	for (i = 0; i < IB_MCAST_BLOCK_SIZE; i++)
-- 
1.5.5




More information about the general mailing list