]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jul 2023 06:37:22 +0000 (08:37 +0200)
[ Upstream commit 246be7d2720ea9a795b576067ecc5e5c7a1e7848 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/kvm/vsie.c

index 2021946176de8f00f1076350192a29bf13f5b0fc..596b2a2cd837deccbc7c9fb39e7f80651ad77c00 100644 (file)
@@ -168,7 +168,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;
 }
@@ -190,7 +191,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;
 }