* [PATCH -next] KVM: x86: Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
@ 2016-07-04 15:13 weiyj_lk
2016-07-04 16:07 ` Paolo Bonzini
0 siblings, 1 reply; 2+ messages in thread
From: weiyj_lk @ 2016-07-04 15:13 UTC (permalink / raw)
To: Paolo Bonzini, rkrcmar, tglx, mingo, hpa; +Cc: Wei Yongjun, x86, kvm
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
arch/x86/kvm/vmx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 3def889..2d963fa 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH -next] KVM: x86: Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
2016-07-04 15:13 [PATCH -next] KVM: x86: Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element weiyj_lk
@ 2016-07-04 16:07 ` Paolo Bonzini
0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2016-07-04 16:07 UTC (permalink / raw)
To: weiyj_lk, rkrcmar, tglx, mingo, hpa; +Cc: Wei Yongjun, x86, kvm
On 04/07/2016 17:13, weiyj_lk@163.com wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element
>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
> arch/x86/kvm/vmx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index 3def889..2d963fa 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -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;
>
>
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Thanks, looks good.
Paolo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-07-04 16:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-04 15:13 [PATCH -next] KVM: x86: Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element weiyj_lk
2016-07-04 16:07 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.