public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] opensm: removed unnecessary checks in main()
@ 2011-03-07 10:01 Alex Netes
       [not found] ` <20110307100146.GI5577-iQai9MGU/dyyaiaB+Ve85laTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Netes @ 2011-03-07 10:01 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

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

--
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

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

* Re: [PATCH] opensm: removed unnecessary checks in main()
       [not found] ` <20110307100146.GI5577-iQai9MGU/dyyaiaB+Ve85laTQe2KTcn/@public.gmane.org>
@ 2011-03-07 15:00   ` Jay Fenlason
  0 siblings, 0 replies; 2+ messages in thread
From: Jay Fenlason @ 2011-03-07 15:00 UTC (permalink / raw)
  To: Alex Netes; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

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

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

end of thread, other threads:[~2011-03-07 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox