[v2] ntdll: Avoid two cases of shift overflow in get_cpuinfo.

Gerald Pfeifer gerald at pfeifer.com
Wed Oct 21 15:21:39 CDT 2015


Now with...

Signed-off-by: Gerald Pfeifer <gerald at pfeifer.com>
---
 dlls/ntdll/nt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c
index 2acaa83..8ae3a98 100644
--- a/dlls/ntdll/nt.c
+++ b/dlls/ntdll/nt.c
@@ -1001,8 +1001,8 @@ static inline void get_cpuinfo(SYSTEM_CPU_INFORMATION* info)
                 do_cpuid(0x80000001, regs2);  /* get vendor features */
                 user_shared_data->ProcessorFeatures[PF_VIRT_FIRMWARE_ENABLED]        = (regs2[2] & (1 << 2  )) >> 2;
                 user_shared_data->ProcessorFeatures[PF_NX_ENABLED]                   = (regs2[3] & (1 << 20 )) >> 20;
-                user_shared_data->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1 << 31 )) >> 31;
-                if(regs2[3] & (1 << 31)) info->FeatureSet |= CPU_FEATURE_3DNOW;
+                user_shared_data->ProcessorFeatures[PF_3DNOW_INSTRUCTIONS_AVAILABLE] = (regs2[3] & (1u << 31 )) >> 31;
+                if(regs2[3] & (1u << 31)) info->FeatureSet |= CPU_FEATURE_3DNOW;
             }
         }
         else if (regs[1] == GENU && regs[3] == INEI && regs[2] == NTEL)
-- 
2.5.1



More information about the wine-patches mailing list