Without the explicit wide type, the shift operation may be performed
on a int which will result in implementation defined behaviour on a
system with more than 32 CPUs.

Signed-off-by: Thomas Graf <tg...@noironetworks.com>
---
 lib/ovs-thread.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c
index fe6fb43..efbd60f 100644
--- a/lib/ovs-thread.c
+++ b/lib/ovs-thread.c
@@ -520,11 +520,11 @@ parse_cpuinfo(long int *n_cores)
                 break;
             }
 
-            if (cpu & (1 << id)) {
+            if (cpu & (1ULL << id)) {
                 /* We've already counted this package's cores. */
                 continue;
             }
-            cpu |= 1 << id;
+            cpu |= 1ULL << id;
 
             /* Find the number of cores for this package. */
             while (fgets(line, sizeof line, stream)) {
-- 
1.9.3

_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to