[PATCH 4/4] s390/vfio-ap: Use AP_DOMAINS for adm_add bitmap size in vfio_ap_mdev_cfg_add()

Anthony Krowiak <[email protected]>
Newsgroups org.kernel.vger.kvm,org.kernel.vger.linux-kernel,org.kernel.vger.linux-s390
Message-ID <[email protected]>
In vfio_ap_mdev_cfg_add(), the bitmap_and() call that computes
the intersection of newly added control domains with those
assigned to each matrix mdev passes AP_DEVICES as the bitmap
size instead of AP_DOMAINS:

    bitmap_and(matrix_mdev->adm_add,
               matrix_mdev->matrix.adm, adm_add, AP_DEVICES);

Control domains are indexed by AP queue index (APQI) and their
bitmaps are sized by AP_DOMAINS, not AP_DEVICES. The two
constants are both 256 today so there is no functional impact,
but the wrong constant is inconsistent with the two bitmap_and()
calls immediately above it and with every other operation on
adm/aqm bitmaps in the file, all of which correctly use
AP_DOMAINS.

Use AP_DOMAINS to keep the code consistent and correct in case
the two constants ever diverge.

Signed-off-by: Anthony Krowiak <[email protected]>
---
 drivers/s390/crypto/vfio_ap_ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/crypto/vfio_ap_ops.c b/drivers/s390/crypto/vfio_ap_ops.c
index c7eebbd0ed40..e62e0dfa7282 100644
--- a/drivers/s390/crypto/vfio_ap_ops.c
+++ b/drivers/s390/crypto/vfio_ap_ops.c
@@ -2840,7 +2840,7 @@ static void vfio_ap_mdev_cfg_add(unsigned long *apm_add, unsigned long *aqm_add,
 		bitmap_and(matrix_mdev->aqm_add,
 			   matrix_mdev->matrix.aqm, aqm_add, AP_DOMAINS);
 		bitmap_and(matrix_mdev->adm_add,
-			   matrix_mdev->matrix.adm, adm_add, AP_DEVICES);
+			   matrix_mdev->matrix.adm, adm_add, AP_DOMAINS);
 
 		mutex_unlock(&matrix_dev->mdevs_lock);
 	}
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.