[PATCH] server: use longer int in bitshift operation (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat Apr 5 05:52:55 CDT 2014


1195662 Bad bit shift operation

1<<x only does "integers", so 1<<32 and higher will result
in 0 most likely.
---
 server/thread.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/thread.c b/server/thread.c
index 896ce0f..9af89b5 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -450,10 +450,10 @@ affinity_t get_thread_affinity( struct thread *thread )
 
         if (!sched_getaffinity( thread->unix_tid, sizeof(set), &set ))
             for (i = 0; i < 8 * sizeof(mask); i++)
-                if (CPU_ISSET( i, &set )) mask |= 1 << i;
+                if (CPU_ISSET( i, &set )) mask |= 1ULL << i;
     }
 #endif
-    if (!mask) mask = ~0;
+    if (!mask) mask = ~0ULL;
     return mask;
 }
 
-- 
1.8.4.5




More information about the wine-patches mailing list