Re: [PATCH v4 16/17] iommufd: Add some fault injection points

Nicolin Chen
2022-11-08T07:25:48Z

On Mon, Nov 07, 2022 at 08:49:09PM -0400, Jason Gunthorpe wrote:

> diff --git a/drivers/iommu/iommufd/main.c b/drivers/iommu/iommufd/main.c

> @@ -489,6 +494,15 @@ static int pages_to_xarray(struct xarray *xa, unsigned long start_index,
>
> xas_lock(&xas);
> while (pages != end_pages) {
> + /* xarray does not participate in fault injection */
> + if (pages == half_pages && iommufd_should_fail()) {
> + xas_set_err(&xas, -EINVAL);
> + xas_unlock(&xas);
> + /* aka xas_destroy() */
> + xas_nomem(&xas, GFP_KERNEL);
> + goto err_clear;

Coverity reports an "unchecked return value" at xas_nomem()...

> +err_clear:
> if (xas_error(&xas)) {

...yet, I think we should be fine since we do xas_error here?