From: Jay Fenlason <fenlason-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] opensm: removed unnecessary checks in main()
Date: Mon, 7 Mar 2011 10:00:48 -0500 [thread overview]
Message-ID: <20110307150047.GA6591@redhat.com> (raw)
In-Reply-To: <20110307100146.GI5577-iQai9MGU/dyyaiaB+Ve85laTQe2KTcn/@public.gmane.org>
On Mon, Mar 07, 2011 at 12:01:46PM +0200, Alex Netes wrote:
> Variable temp is unsigned.
>
> Signed-off-by: Alex Netes <alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
> opensm/main.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/opensm/main.c b/opensm/main.c
> index 756fe6f..ef4b805 100644
> --- a/opensm/main.c
> +++ b/opensm/main.c
> @@ -987,7 +987,7 @@ int main(int argc, char *argv[])
> break;
> case 6:
> temp = strtol(optarg, NULL, 0);
> - if (temp < 0 || temp >= IB_MAX_NUM_VLS) {
> + if (temp >= IB_MAX_NUM_VLS) {
> fprintf(stderr,
> "ERROR: starting lash vl must be between 0 and 15\n");
> return -1;
> @@ -997,7 +997,7 @@ int main(int argc, char *argv[])
> break;
> case 7:
> temp = strtol(optarg, NULL, 0);
> - if (temp < 0 || temp > 15) {
> + if (temp > 15) {
> fprintf(stderr,
> "ERROR: SM's SL must be between 0 and 15\n");
> return -1;
> --
> 1.7.3.4
>
> --
strtol() returs a long, not unsigned, therefor either temp must be
changed to match (and keep the < 0 tests) or a different function must
be used (strtoul()?).
-- JF
--
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
prev parent reply other threads:[~2011-03-07 15:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-07 10:01 [PATCH] opensm: removed unnecessary checks in main() Alex Netes
[not found] ` <20110307100146.GI5577-iQai9MGU/dyyaiaB+Ve85laTQe2KTcn/@public.gmane.org>
2011-03-07 15:00 ` Jay Fenlason [this message]
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=20110307150047.GA6591@redhat.com \
--to=fenlason-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=alexne-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@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 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.