mirror of
https://github.com/torvalds/linux.git
synced 2024-11-30 08:01:59 +00:00
KVM: s390: replace bitmap_copy with bitmap_{from,to}_arr64 where appropriate
Copying bitmaps from/to 64-bit arrays with bitmap_copy is not safe on 32-bit BE machines. Use designated functions instead. CC: Alexander Gordeev <agordeev@linux.ibm.com> CC: Andy Shevchenko <andriy.shevchenko@linux.intel.com> CC: Christian Borntraeger <borntraeger@linux.ibm.com> CC: Claudio Imbrenda <imbrenda@linux.ibm.com> CC: David Hildenbrand <david@redhat.com> CC: Heiko Carstens <hca@linux.ibm.com> CC: Janosch Frank <frankja@linux.ibm.com> CC: Rasmus Villemoes <linux@rasmusvillemoes.dk> CC: Sven Schnelle <svens@linux.ibm.com> CC: Vasily Gorbik <gor@linux.ibm.com> Signed-off-by: Yury Norov <yury.norov@gmail.com> Reviewed-by: David Hildenbrand <david@redhat.com>
This commit is contained in:
parent
2c523550b9
commit
da0f8e957b
@ -1332,8 +1332,7 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm,
|
||||
mutex_unlock(&kvm->lock);
|
||||
return -EBUSY;
|
||||
}
|
||||
bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat,
|
||||
KVM_S390_VM_CPU_FEAT_NR_BITS);
|
||||
bitmap_from_arr64(kvm->arch.cpu_feat, data.feat, KVM_S390_VM_CPU_FEAT_NR_BITS);
|
||||
mutex_unlock(&kvm->lock);
|
||||
VM_EVENT(kvm, 3, "SET: guest feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
|
||||
data.feat[0],
|
||||
@ -1504,8 +1503,7 @@ static int kvm_s390_get_processor_feat(struct kvm *kvm,
|
||||
{
|
||||
struct kvm_s390_vm_cpu_feat data;
|
||||
|
||||
bitmap_copy((unsigned long *) data.feat, kvm->arch.cpu_feat,
|
||||
KVM_S390_VM_CPU_FEAT_NR_BITS);
|
||||
bitmap_to_arr64(data.feat, kvm->arch.cpu_feat, KVM_S390_VM_CPU_FEAT_NR_BITS);
|
||||
if (copy_to_user((void __user *)attr->addr, &data, sizeof(data)))
|
||||
return -EFAULT;
|
||||
VM_EVENT(kvm, 3, "GET: guest feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
|
||||
@ -1520,9 +1518,7 @@ static int kvm_s390_get_machine_feat(struct kvm *kvm,
|
||||
{
|
||||
struct kvm_s390_vm_cpu_feat data;
|
||||
|
||||
bitmap_copy((unsigned long *) data.feat,
|
||||
kvm_s390_available_cpu_feat,
|
||||
KVM_S390_VM_CPU_FEAT_NR_BITS);
|
||||
bitmap_to_arr64(data.feat, kvm_s390_available_cpu_feat, KVM_S390_VM_CPU_FEAT_NR_BITS);
|
||||
if (copy_to_user((void __user *)attr->addr, &data, sizeof(data)))
|
||||
return -EFAULT;
|
||||
VM_EVENT(kvm, 3, "GET: host feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
|
||||
|
Loading…
Reference in New Issue
Block a user