Skip to content

Commit da0f8e9

Browse files
committed
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 <[email protected]> CC: Andy Shevchenko <[email protected]> CC: Christian Borntraeger <[email protected]> CC: Claudio Imbrenda <[email protected]> CC: David Hildenbrand <[email protected]> CC: Heiko Carstens <[email protected]> CC: Janosch Frank <[email protected]> CC: Rasmus Villemoes <[email protected]> CC: Sven Schnelle <[email protected]> CC: Vasily Gorbik <[email protected]> Signed-off-by: Yury Norov <[email protected]> Reviewed-by: David Hildenbrand <[email protected]>
1 parent 2c52355 commit da0f8e9

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

arch/s390/kvm/kvm-s390.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1332,8 +1332,7 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm,
13321332
mutex_unlock(&kvm->lock);
13331333
return -EBUSY;
13341334
}
1335-
bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat,
1336-
KVM_S390_VM_CPU_FEAT_NR_BITS);
1335+
bitmap_from_arr64(kvm->arch.cpu_feat, data.feat, KVM_S390_VM_CPU_FEAT_NR_BITS);
13371336
mutex_unlock(&kvm->lock);
13381337
VM_EVENT(kvm, 3, "SET: guest feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",
13391338
data.feat[0],
@@ -1504,8 +1503,7 @@ static int kvm_s390_get_processor_feat(struct kvm *kvm,
15041503
{
15051504
struct kvm_s390_vm_cpu_feat data;
15061505

1507-
bitmap_copy((unsigned long *) data.feat, kvm->arch.cpu_feat,
1508-
KVM_S390_VM_CPU_FEAT_NR_BITS);
1506+
bitmap_to_arr64(data.feat, kvm->arch.cpu_feat, KVM_S390_VM_CPU_FEAT_NR_BITS);
15091507
if (copy_to_user((void __user *)attr->addr, &data, sizeof(data)))
15101508
return -EFAULT;
15111509
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,
15201518
{
15211519
struct kvm_s390_vm_cpu_feat data;
15221520

1523-
bitmap_copy((unsigned long *) data.feat,
1524-
kvm_s390_available_cpu_feat,
1525-
KVM_S390_VM_CPU_FEAT_NR_BITS);
1521+
bitmap_to_arr64(data.feat, kvm_s390_available_cpu_feat, KVM_S390_VM_CPU_FEAT_NR_BITS);
15261522
if (copy_to_user((void __user *)attr->addr, &data, sizeof(data)))
15271523
return -EFAULT;
15281524
VM_EVENT(kvm, 3, "GET: host feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx",

0 commit comments

Comments
 (0)