Skip to contentSkip to conversation

opensm: removed unnecessary checks in main()

PATCH In review Alex Netes 2 participants 2 messages Mar 7, 2011 1 message not in the archive InfiniBand

lore
Share & tools
lore

Alex Netes

author
#0 lore raw

PATCH 1/1 opensm: removed unnecessary checks in main()

Variable temp is unsigned.

---
 opensm/main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
opensm/main.c +2 -2
index 756fe6f..ef4b805 100644
@@ -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;
Signature · 6 lines
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
In reply to a message not in the archive
Quoted 33 lines · Alex Netes

Variable temp is unsigned.

---
 opensm/main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
opensm/main.c +2 -2
index 756fe6f..ef4b805 100644
@@ -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;
Signature · 3 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html