[ofa-general] [PATCH] opensm: fixing handling of opt.max_wire_smps
Yevgeny Kliteynik
kliteyn at dev.mellanox.co.il
Tue Aug 4 07:32:56 PDT 2009
opt.max_wire_smps is uint32, but then when it's propagated
into the VL15 poller it's casted to int32. Fixing the
parameter handling to protect it from wrong values.
Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
---
opensm/opensm/main.c | 2 +-
opensm/opensm/osm_subnet.c | 7 +++++++
2 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/opensm/opensm/main.c b/opensm/opensm/main.c
index 296d5d5..9cb9990 100644
--- a/opensm/opensm/main.c
+++ b/opensm/opensm/main.c
@@ -722,7 +722,7 @@ int main(int argc, char *argv[])
case 'n':
opt.max_wire_smps = strtol(optarg, NULL, 0);
- if (opt.max_wire_smps <= 0)
+ if (opt.max_wire_smps > 0x7FFFFFFF)
opt.max_wire_smps = 0x7FFFFFFF;
printf(" Max wire smp's = %d\n", opt.max_wire_smps);
break;
diff --git a/opensm/opensm/osm_subnet.c b/opensm/opensm/osm_subnet.c
index ec15f8a..c07d823 100644
--- a/opensm/opensm/osm_subnet.c
+++ b/opensm/opensm/osm_subnet.c
@@ -1066,6 +1066,13 @@ int osm_subn_verify_config(IN osm_subn_opt_t * const p_opts)
p_opts->force_link_speed = IB_PORT_LINK_SPEED_ENABLED_MASK;
}
+ if (p_opts->max_wire_smps > 0x7FFFFFFF) {
+ log_report(" Invalid Cached Option Value: max_wire_smps = %u,"
+ " Using Default: %u\n",
+ p_opts->max_wire_smps, OSM_DEFAULT_SMP_MAX_ON_WIRE);
+ p_opts->max_wire_smps = OSM_DEFAULT_SMP_MAX_ON_WIRE;
+ }
+
if (strcmp(p_opts->console, OSM_DISABLE_CONSOLE)
&& strcmp(p_opts->console, OSM_LOCAL_CONSOLE)
#ifdef ENABLE_OSM_CONSOLE_SOCKET
--
1.5.1.4
More information about the general
mailing list