Re: [PATCH v1 11/12] iommufd: Introduce iommufd_object_alloc_ucmd helper

From: Jason Gunthorpe
Date: Fri Jun 13 2025 - 10:09:56 EST


On Mon, Jun 09, 2025 at 10:13:34AM -0700, Nicolin Chen wrote:

> +#define iommufd_object_alloc_ucmd(ucmd, ptr, type) \
> + __iommufd_object_alloc_ucmd(ucmd, ptr, type, obj)

Lets add a comment here and on the normal iommufd_object_alloc
explaining that this function automatically calls finalize and abort,
the non ucmd version requires the caller to do so.

> +struct iommufd_object *_iommufd_object_alloc_ucmd(struct iommufd_ucmd *ucmd,
> + size_t size,
> + enum iommufd_object_type type)
> +{
> + struct iommufd_object *new_obj;
> +
> + if (ucmd->new_obj)

WARN_ON? Something is coded wrong if we hit this right?

Jason