Linux-rt-users archive mirror
 help / color / mirror / Atom feed
From: John Kacur <jkacur@redhat.com>
To: RT <linux-rt-users@vger.kernel.org>
Cc: John Kacur <jkacur@redhat.com>
Subject: [PATCH] rt-tests:ssdd: Ensure there are one or more iterations
Date: Fri,  5 Apr 2024 18:46:47 -0400	[thread overview]
Message-ID: <20240405224647.102211-1-jkacur@redhat.com> (raw)

There must be one or more iterations, prevent the user from
entering a number less than one

Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/ssdd/ssdd.8 | 2 ++
 src/ssdd/ssdd.c | 5 ++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/ssdd/ssdd.8 b/src/ssdd/ssdd.8
index e6be5ef6a27d..71cb71ad0817 100644
--- a/src/ssdd/ssdd.8
+++ b/src/ssdd/ssdd.8
@@ -26,6 +26,8 @@ number of PTRACE_SINGLESTEP iterations to do before declaring
 success, for each tracer tracee pair set up.
 .br
 Default is 10,000.
+.br
+NUM must be at least 1
 .TP
 .B \-\-json=FILENAME
 Write final results into FILENAME, JSON formatted.
diff --git a/src/ssdd/ssdd.c b/src/ssdd/ssdd.c
index cad901b563d8..45f6a23910ca 100644
--- a/src/ssdd/ssdd.c
+++ b/src/ssdd/ssdd.c
@@ -80,7 +80,7 @@ static void usage(int error)
 	       "-h       --help            print this message\n"
 	       "         --json=FILENAME   write final results into FILENAME, JSON formatted\n"
 	       "-q       --quiet           suppress running output\n"
-	       "-i       --iters=NUM       number of iterations\n"
+	       "-i       --iters=NUM       number of iterations, NUM must be at least 1\n"
 	       );
 	exit(error);
 }
@@ -331,6 +331,9 @@ int main(int argc, char **argv)
 		case 'i':
 		case OPT_NITERS:
 			nsteps = atoi(optarg);
+			if (nsteps < 1) {
+				usage(0);
+			}
 			break;
 		default:
 			usage(1);
-- 
2.44.0


                 reply	other threads:[~2024-04-05 22:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240405224647.102211-1-jkacur@redhat.com \
    --to=jkacur@redhat.com \
    --cc=linux-rt-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).