KVM: s390: vsie: fix the length of APCB bitmap
authorPierre Morel <pmorel@linux.ibm.com>
Wed, 10 May 2023 15:42:58 +0000 (17:42 +0200)
committerJanosch Frank <frankja@linux.ibm.com>
Fri, 16 Jun 2023 09:08:09 +0000 (11:08 +0200)
bit_and() uses the count of bits as the woking length.
Fix the previous implementation and effectively use
the right bitmap size.

Fixes: 19fd83a64718 ("KVM: s390: vsie: allow CRYCB FORMAT-1")
Fixes: 56019f9aca22 ("KVM: s390: vsie: Allow CRYCB FORMAT-2")
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/kvm/20230511094719.9691-1-pmorel@linux.ibm.com/
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
arch/s390/kvm/vsie.c

index 8d6b765abf29bffd3a9c5ef57f44b10645e0f3a4..0333ee482eb894d477bf54bb44007ec87d100297 100644 (file)
@@ -177,7 +177,8 @@ static int setup_apcb00(struct kvm_vcpu *vcpu, unsigned long *apcb_s,
                            sizeof(struct kvm_s390_apcb0)))
                return -EFAULT;
 
-       bitmap_and(apcb_s, apcb_s, apcb_h, sizeof(struct kvm_s390_apcb0));
+       bitmap_and(apcb_s, apcb_s, apcb_h,
+                  BITS_PER_BYTE * sizeof(struct kvm_s390_apcb0));
 
        return 0;
 }
@@ -203,7 +204,8 @@ static int setup_apcb11(struct kvm_vcpu *vcpu, unsigned long *apcb_s,
                            sizeof(struct kvm_s390_apcb1)))
                return -EFAULT;
 
-       bitmap_and(apcb_s, apcb_s, apcb_h, sizeof(struct kvm_s390_apcb1));
+       bitmap_and(apcb_s, apcb_s, apcb_h,
+                  BITS_PER_BYTE * sizeof(struct kvm_s390_apcb1));
 
        return 0;
 }