[openib-general] [PATCH] Opensm - discovered lids issue

Yael Kalka yael at mellanox.co.il
Sun Sep 25 00:20:19 PDT 2005


Hi Hal,

During our windows checks we noticed an issue in
the __osm_lid_mgr_init_sweep function under osm_lid_mgr.c.
The initializing of max_persistent_lid and max_discovered_lid is
correct only if the vector is not empty. 
Attached is a patch resolving this issue.

Thanks,
Yael

Signed-off-by:  Yael Kalka <yael at mellanox.co.il>

Index: opensm/osm_lid_mgr.c
===================================================================
--- opensm/osm_lid_mgr.c	(revision 3395)
+++ opensm/osm_lid_mgr.c	(working copy)
@@ -418,8 +418,12 @@ __osm_lid_mgr_init_sweep(
   */
 
   /* find the range of lids to scan */
-  max_discovered_lid = cl_ptr_vector_get_size(p_discovered_vec) - 1;
-  max_persistent_lid = cl_ptr_vector_get_size(p_persistent_vec) - 1;
+  max_discovered_lid = (uint16_t)cl_ptr_vector_get_size(p_discovered_vec);
+  max_persistent_lid = (uint16_t)cl_ptr_vector_get_size(p_persistent_vec);
+
+  /* but the vectors have one extra entry for lid=0 */
+  if (max_discovered_lid) max_discovered_lid--;
+  if (max_persistent_lid) max_persistent_lid--;
 
   if (max_persistent_lid > max_discovered_lid)
     max_defined_lid = max_persistent_lid;




More information about the general mailing list