Skip to contentSkip to conversation

ringtest: fix an assert statement

PATCH In review Dan Carpenter 2 participants 3 messages Apr 15, 2017 – Apr 18, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ringtest: fix an assert statement

There is an || vs && typo so the assert can never be triggered.

tools/virtio/ringtest/main.c +1 -1
index 022ae95a06bd..453ca3c21193 100644
@@ -87,7 +87,7 @@ void set_affinity(const char *arg)
 	cpu = strtol(arg, &endptr, 0);
 	assert(!*endptr);
 
-	assert(cpu >= 0 || cpu < CPU_SETSIZE);
+	assert(cpu >= 0 && cpu < CPU_SETSIZE);
 
 	self = pthread_self();
 	CPU_ZERO(&cpuset);
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · Dan Carpenter

There is an || vs && typo so the assert can never be triggered.

tools/virtio/ringtest/main.c +0 -0
index 022ae95a06bd..453ca3c21193 100644

tools/virtio/ringtest/main.c void set_affinity(const char *arg) · line 93

Quoted 8 lines
tools/virtio/ringtest/main.c +1 -1
@@ -87,7 +87,7 @@ void set_affinity(const char *arg)
  	cpu = strtol(arg, &endptr, 0);
  	assert(!*endptr);
 
-	assert(cpu >= 0 || cpu < CPU_SETSIZE);
+	assert(cpu >= 0 && cpu < CPU_SETSIZE);
 
  	self = pthread_self();
  	CPU_ZERO(&cpuset);
Acked-by on v1 1/1
#2 lore raw
In reply to Dan Carpenter
Quoted 9 lines · Dan Carpenter

There is an || vs && typo so the assert can never be triggered.

tools/virtio/ringtest/main.c +0 -0
index 022ae95a06bd..453ca3c21193 100644

tools/virtio/ringtest/main.c void set_affinity(const char *arg) · line 93

Quoted 8 lines
tools/virtio/ringtest/main.c +1 -1
@@ -87,7 +87,7 @@ void set_affinity(const char *arg)
  	cpu = strtol(arg, &endptr, 0);
  	assert(!*endptr);
 
-	assert(cpu >= 0 || cpu < CPU_SETSIZE);
+	assert(cpu >= 0 && cpu < CPU_SETSIZE);
 
  	self = pthread_self();
  	CPU_ZERO(&cpuset);

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/virtualization