server: Remove dead check in is_cpu_supported().
Gerald Pfeifer
gerald at pfeifer.com
Sat Jan 21 09:25:08 CST 2017
I am wondering about the following piece of code in server/thread.c:
int is_cpu_supported( enum cpu_type cpu )
{
unsigned int prefix_cpu_mask = get_prefix_cpu_mask();
if (CPU_FLAG(cpu) && (supported_cpus & prefix_cpu_mask & CPU_FLAG(cpu))) return 1;
that was added as part of
commit 1e78c99388c61d353cf60787eac6415328f54560
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Nov 22 12:32:48 2013 +0100
kernel32: Validate the architecture of newly created processes on the server side.
Now include/wine/server_protocol.h has
enum cpu_type
{
CPU_x86, CPU_x86_64, CPU_POWERPC, CPU_ARM, CPU_ARM64
};
so CPU_x86 = 0, CPU_x86_64 = 1,... and server/process.h defines
CPU_FLAG(cpu) as (1 << (cpu)).
That means CPU_FLAG(...) is always positive and different from zero
-- unless its parameter is 32 or higher on a 32-bit architecture
(and the 1 shifts out).
Am I missing something here? Or can we apply the patch below?
Gerald
Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
---
server/thread.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/thread.c b/server/thread.c
index e18c208121..67f976d33c 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -1220,7 +1220,7 @@ int is_cpu_supported( enum cpu_type cpu )
{
unsigned int prefix_cpu_mask = get_prefix_cpu_mask();
- if (CPU_FLAG(cpu) && (supported_cpus & prefix_cpu_mask & CPU_FLAG(cpu))) return 1;
+ if (supported_cpus & prefix_cpu_mask & CPU_FLAG(cpu)) return 1;
if (!(supported_cpus & prefix_cpu_mask))
set_error( STATUS_NOT_SUPPORTED );
else if (supported_cpus & CPU_FLAG(cpu))
--
2.11.0
More information about the wine-patches
mailing list