KVM: x86: Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Mon, 4 Jul 2016 15:13:07 +0000 (15:13 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 5 Jul 2016 12:41:45 +0000 (14:41 +0200)
Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/vmx.c

index 85e2f0a882ca9940fdb6ab36cb74cdabca941994..e564fa2c7ac88112495ea5deb7f8512d27a6986a 100644 (file)
@@ -1112,7 +1112,7 @@ static inline bool cpu_has_broken_vmx_preemption_timer(void)
 
        /* Clear the reserved bits */
        eax &= ~(0x3U << 14 | 0xfU << 28);
-       for (i = 0; i < sizeof(vmx_preemption_cpu_tfms)/sizeof(u32); i++)
+       for (i = 0; i < ARRAY_SIZE(vmx_preemption_cpu_tfms); i++)
                if (eax == vmx_preemption_cpu_tfms[i])
                        return true;