[ofa-general] [PATCH] opensm/osm_helper.c: fixing PortInfo CapMask printing

Sasha Khapyorsky sashak at voltaire.com
Thu Jun 14 04:37:57 PDT 2007


When PortInfo:CapMask is zero, non-initialized local buffer (garbage)
is printed. There is the fix.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/opensm/osm_helper.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/opensm/opensm/osm_helper.c b/opensm/opensm/osm_helper.c
index 724ecdf..2b35bdd 100644
--- a/opensm/opensm/osm_helper.c
+++ b/opensm/opensm/osm_helper.c
@@ -546,9 +546,6 @@ osm_dbg_get_capabilities_str(
   uint32_t total_len = 0;
   char *p_local = p_buf;
 
-  if( !p_pi->capability_mask )
-    return;
-
   strcpy( p_local, "Capability Mask:\n" );
   p_local += strlen( p_local );
 
@@ -839,9 +836,11 @@ osm_dump_port_info(
              );
 
     /*  show the capabilities mask */
-    osm_dbg_get_capabilities_str( buf, BUF_SIZE, "\t\t\t\t", p_pi );
-
-    osm_log( p_log, log_level, "%s", buf );
+    if( p_pi->capability_mask )
+    {
+      osm_dbg_get_capabilities_str( buf, BUF_SIZE, "\t\t\t\t", p_pi );
+      osm_log( p_log, log_level, "%s", buf );
+    }
   }
 }
 
@@ -936,9 +935,11 @@ osm_dump_portinfo_record(
              );
 
     /*  show the capabilities mask */
-    osm_dbg_get_capabilities_str( buf, BUF_SIZE, "\t\t\t\t", p_pi );
-
-    osm_log( p_log, log_level, "%s", buf );
+    if( p_pi->capability_mask )
+    {
+      osm_dbg_get_capabilities_str( buf, BUF_SIZE, "\t\t\t\t", p_pi );
+      osm_log( p_log, log_level, "%s", buf );
+    }
   }
 }
 
-- 
1.5.2.1.137.g426c




More information about the general mailing list