mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-05 10:04:12 +08: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);
|
mutex_unlock(&kvm->lock);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat,
|
bitmap_from_arr64(kvm->arch.cpu_feat, data.feat, KVM_S390_VM_CPU_FEAT_NR_BITS);
|
||||||
KVM_S390_VM_CPU_FEAT_NR_BITS);
|
|
||||||
mutex_unlock(&kvm->lock);
|
mutex_unlock(&kvm->lock);
|
||||||
VM_EVENT(kvm, 3, "SET: guest feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
|
VM_EVENT(kvm, 3, "SET: guest feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
|
||||||
data.feat[0],
|
data.feat[0],
|
||||||
@ -1504,8 +1503,7 @@ static int kvm_s390_get_processor_feat(struct kvm *kvm,
|
|||||||
{
|
{
|
||||||
struct kvm_s390_vm_cpu_feat data;
|
struct kvm_s390_vm_cpu_feat data;
|
||||||
|
|
||||||
bitmap_copy((unsigned long *) data.feat, kvm->arch.cpu_feat,
|
bitmap_to_arr64(data.feat, kvm->arch.cpu_feat, KVM_S390_VM_CPU_FEAT_NR_BITS);
|
||||||
KVM_S390_VM_CPU_FEAT_NR_BITS);
|
|
||||||
if (copy_to_user((void __user *)attr->addr, &data, sizeof(data)))
|
if (copy_to_user((void __user *)attr->addr, &data, sizeof(data)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
VM_EVENT(kvm, 3, "GET: guest feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
|
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;
|
struct kvm_s390_vm_cpu_feat data;
|
||||||
|
|
||||||
bitmap_copy((unsigned long *) data.feat,
|
bitmap_to_arr64(data.feat, kvm_s390_available_cpu_feat, KVM_S390_VM_CPU_FEAT_NR_BITS);
|
||||||
kvm_s390_available_cpu_feat,
|
|
||||||
KVM_S390_VM_CPU_FEAT_NR_BITS);
|
|
||||||
if (copy_to_user((void __user *)attr->addr, &data, sizeof(data)))
|
if (copy_to_user((void __user *)attr->addr, &data, sizeof(data)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
VM_EVENT(kvm, 3, "GET: host feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
|
VM_EVENT(kvm, 3, "GET: host feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
|
||||||
|
Loading…
Reference in New Issue
Block a user