unsigned long page_size, void __user *uptr,
u32 flags)
{
- unsigned long bitmap_size, i, max = length / page_size;
+ unsigned long bitmap_size, i, max;
struct iommu_test_cmd *cmd = ucmd->cmd;
struct iommufd_hw_pagetable *hwpt;
struct mock_iommu_domain *mock;
int rc, count = 0;
void *tmp;
- if (iova % page_size || length % page_size || !uptr)
+ if (!page_size || !length || iova % page_size || length % page_size ||
+ !uptr)
return -EINVAL;
hwpt = get_md_pagetable(ucmd, mockpt_id, &mock);
goto out_put;
}
+ max = length / page_size;
bitmap_size = max / BITS_PER_BYTE;
tmp = kvzalloc(bitmap_size, GFP_KERNEL_ACCOUNT);