[PATCH v6 10/25] iommufd/viommu: Add IOMMUFD_CMD_HW_QUEUE_ALLOC ioctl

Tian, Kevin kevin.tian at intel.com
Tue Jun 24 20:45:08 PDT 2025


> From: Nicolin Chen <nicolinc at nvidia.com>
> Sent: Saturday, June 14, 2025 3:15 PM
> +
> +	offset =
> +		cmd->nesting_parent_iova - PAGE_ALIGN(cmd-
> >nesting_parent_iova);
> +	max_npages = DIV_ROUND_UP(offset + cmd->length, PAGE_SIZE);
> +
> +	/*
> +	 * FIXME allocation may fail when sizeof(*pages) * max_npages is
> +	 * larger than PAGE_SIZE. This might need a new API returning a
> +	 * bio_vec or something more efficient.
> +	 */
> +	pages = kcalloc(max_npages, sizeof(*pages), GFP_KERNEL);
> +	if (!pages)
> +		return ERR_PTR(-ENOMEM);
> +

any allocation may fail... can you elaborate more here? How does
PAGE_SIZE become a boundary?



More information about the linux-arm-kernel mailing list