KVM: s390: fix calculation of idle_mask array size
authorJens Freimann <jfrei@linux.vnet.ibm.com>
Tue, 18 Mar 2014 15:34:18 +0000 (16:34 +0100)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Tue, 25 Mar 2014 12:27:11 +0000 (13:27 +0100)
We need BITS_TO_LONGS, not sizeof(long) to calculate
the correct size.

idle_mask is a bitmask, each bit representing the state
of a cpu. The desired outcome is an array of unsigned long
fields that can fit KVM_MAX_VCPUS bits. We should not use
sizeof(long) which returnes the size in bytes, but BITS_TO_LONGS

Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/include/asm/kvm_host.h

index 734d302ba389996c6f29e62df89be43b8e294017..c36cd35e03f388b13d4323f445d6e3e7853f355f 100644 (file)
@@ -213,8 +213,7 @@ struct kvm_s390_float_interrupt {
        struct list_head list;
        atomic_t active;
        int next_rr_cpu;
-       unsigned long idle_mask[(KVM_MAX_VCPUS + sizeof(long) - 1)
-                               / sizeof(long)];
+       unsigned long idle_mask[BITS_TO_LONGS(KVM_MAX_VCPUS)];
        unsigned int irq_count;
 };