This is a note to let you know that I've just added the patch titled iommufd/selftest: Fix iommufd_test_dirty() to handle <u8 bitmaps to the 6.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: iommufd-selftest-fix-iommufd_test_dirty-to-handle-u8.patch and it can be found in the queue-6.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit a5d4b9a8e6f1b8e0adc8652cce35730985a088e8 Author: Joao Martins <joao.m.martins@xxxxxxxxxx> Date: Thu Jun 27 12:00:56 2024 +0100 iommufd/selftest: Fix iommufd_test_dirty() to handle <u8 bitmaps [ Upstream commit 9560393b830b415b2151b3dd8e065257cccbffa7 ] The calculation returns 0 if it sets less than the number of bits per byte. For calculating memory allocation from bits, lets round it up to one byte. Link: https://lore.kernel.org/r/20240627110105.62325-3-joao.m.martins@xxxxxxxxxx Reported-by: Matt Ochs <mochs@xxxxxxxxxx> Fixes: a9af47e382a4 ("iommufd/selftest: Test IOMMU_HWPT_GET_DIRTY_BITMAP") Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> Tested-by: Matt Ochs <mochs@xxxxxxxxxx> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/iommu/iommufd/selftest.c b/drivers/iommu/iommufd/selftest.c index 7a2199470f312..654ed33390957 100644 --- a/drivers/iommu/iommufd/selftest.c +++ b/drivers/iommu/iommufd/selftest.c @@ -1334,7 +1334,7 @@ static int iommufd_test_dirty(struct iommufd_ucmd *ucmd, unsigned int mockpt_id, } max = length / page_size; - bitmap_size = max / BITS_PER_BYTE; + bitmap_size = DIV_ROUND_UP(max, BITS_PER_BYTE); tmp = kvzalloc(bitmap_size, GFP_KERNEL_ACCOUNT); if (!tmp) {