All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rt-migrate-test: exit early if nr_runs is non-positive
@ 2014-11-27 10:20 Boris Egorov
  2015-02-17 14:08 ` Sebastian Andrzej Siewior
  2015-02-17 17:43 ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Boris Egorov
  0 siblings, 2 replies; 9+ messages in thread
From: Boris Egorov @ 2014-11-27 10:20 UTC (permalink / raw)
  To: 716237, linux-rt-users; +Cc: Boris Egorov

Program will crash if nr_runs is 0 due to dividing by it in
print_results(). Let's exit early instead.

Fixes: http://bugs.debian.org/716237

Signed-off-by: Boris Egorov <egorov@linux.com>
---
 src/rt-migrate-test/rt-migrate-test.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/rt-migrate-test/rt-migrate-test.c
b/src/rt-migrate-test/rt-migrate-test.c
index e3c7a09..876a122 100644
--- a/src/rt-migrate-test/rt-migrate-test.c
+++ b/src/rt-migrate-test/rt-migrate-test.c
@@ -465,6 +465,11 @@ int main (int argc, char **argv)
  	parse_options(argc, argv);
+	if (nr_runs <= 0) {
+		fprintf(stderr, "Warning, --loops argument is non-positive. Exiting.\n");
+		exit(-1);
+	}
+
 	signal(SIGINT, stop_log);
  	if (argc >= (optind + 1))
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-02-17 19:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-27 10:20 [PATCH] rt-migrate-test: exit early if nr_runs is non-positive Boris Egorov
2015-02-17 14:08 ` Sebastian Andrzej Siewior
2015-02-17 14:30   ` Boris Egorov
2015-02-17 14:35     ` Boris Egorov
2015-02-17 16:51       ` John Kacur
2015-02-17 17:43 ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Boris Egorov
2015-02-17 17:43   ` [PATCH v2 1/2] rt-migrate-test: exit early if nr_runs is non-positive Boris Egorov
2015-02-17 17:43   ` [PATCH v2 2/2] rt-migrate-test: use variables instead of macros Boris Egorov
2015-02-17 19:27   ` [PATCH v2 0/2] rt-migrate-test: few sanity fixes Clark Williams

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.