Skip to contentSkip to conversation

opensm/console: protect against 0 entered for the perfmgr sweep_time

PATCH In review Ira Weiny 1 participant 1 message Jul 3, 2012 InfiniBand

lore
Share & tools
lore

Ira Weiny

author
#0 lore raw

PATCH 2/10 opensm/console: protect against 0 entered for the perfmgr sweep_time

The config file already has a check for 0. This adds the same check to the console "perfmgr sweep_time" command.

---
 opensm/osm_console.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
opensm/osm_console.c +12 -3
index ad3a4d7..5b602d1 100644
@@ -1471,11 +1471,20 @@ static void perfmgr_parse(char **p_last, osm_opensm_t * p_osm, FILE * out)
 			p_cmd = next_token(p_last);
 			if (p_cmd) {
 				uint16_t time_s = atoi(p_cmd);
-				osm_perfmgr_set_sweep_time_s(&p_osm->perfmgr,
-							     time_s);
+				if (time_s < 1)
+					fprintf(out,
+						"sweep_time requires a "
+						"positive time period "
+						"(in seconds) to be "
+						"specified\n");
+				else
+					osm_perfmgr_set_sweep_time_s(
+							&p_osm->perfmgr,
+							time_s);
 			} else {
 				fprintf(out,
-					"sweep_time requires a time period (in seconds) to be specified\n");
+					"sweep_time requires a time period "
+					"(in seconds) to be specified\n");
 			}
 		} else {
 			fprintf(out, "\"%s\" option not found\n", p_cmd);
Signature · 6 lines
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html