History

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.

Yury Norov committed 4 years ago

Commit da0f8e91 parent 2c523551 file · +3 −7Browse files

Unified · Split

arch/s390/kvm/kvm-s390.c+3−7
@@ -1332,8 +1332,7 @@ static int kvm_s390_set_processor_feat(struct kvm *kvm, · 1331 unmodified lines
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, · 164 unmodified lines
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, · 8 unmodified lines
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",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t