public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Ira Weiny <weiny2-i2BcT+NCU+M@public.gmane.org>
To: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
Cc: "linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH] infiniband-diags: Verify timeout value specified to diagnostics
Date: Wed, 15 Dec 2010 11:47:09 -0800	[thread overview]
Message-ID: <20101215114709.82671602.weiny2@llnl.gov> (raw)


Verify timeout value specified to diagnostics


Signed-off-by: Ira Weiny <weiny2-eSE4LqFkL++LYFxP40JT4w@public.gmane.org>
---
 infiniband-diags/src/ibdiag_common.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/infiniband-diags/src/ibdiag_common.c b/infiniband-diags/src/ibdiag_common.c
index 99861f1..8ccf2fc 100644
--- a/infiniband-diags/src/ibdiag_common.c
+++ b/infiniband-diags/src/ibdiag_common.c
@@ -175,9 +175,13 @@ static int process_opt(int ch, char *optarg)
 		ibd_dest_type = IB_DEST_GUID;
 		break;
 	case 't':
-		val = strtoul(optarg, 0, 0);
-		madrpc_set_timeout(val);
-		ibd_timeout = val;
+		val = (int)strtol(optarg, NULL, 0);
+		if (val > 0) {
+			madrpc_set_timeout(val);
+			ibd_timeout = val;
+		} else
+			IBERROR("Invalid timeout \"%s\".  Timeout requires a "
+				"positive integer value.", optarg);
 		break;
 	case 's':
 		/* srcport is not required when resolving via IB_DEST_LID */
-- 
1.5.4.5

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

             reply	other threads:[~2010-12-15 19:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-15 19:47 Ira Weiny [this message]
     [not found] ` <20101215114709.82671602.weiny2-i2BcT+NCU+M@public.gmane.org>
2010-12-20 15:31   ` [PATCH] infiniband-diags: Verify timeout value specified to diagnostics Sasha Khapyorsky
  -- strict thread matches above, loose matches on Subject: below --
2010-12-20 21:57 Jay Fenlason

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=20101215114709.82671602.weiny2@llnl.gov \
    --to=weiny2-i2bct+ncu+m@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sashak-smomgflXvOZWk0Htik3J/w@public.gmane.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