Re: [PATCH v7 3/4] iommufd: Add IOMMU_GET_HW_INFO

From: Nicolin Chen
Date: Tue Aug 15 2023 - 14:55:50 EST


On Tue, Aug 15, 2023 at 03:29:21PM -0300, Jason Gunthorpe wrote:

> Well the way it ought to work is that userspace can pass in 0 length
> and the kernel will return the correct length
>
> So maybe this does need resending with this removed:
>
> *length = min(*length, data_len);

That "length" is 0 (copying the value of cmd->data_len), so it
should be 0 even having this line?

> Also I see clear_user is called wrong, it doesn't return errno.

Oh, right.

> Please check and repost it ASAP I will update the branch. Probably
> needs some doc adjusting too.

I think your version should be good. I can update the series for
the doc part. Yi can confirm tonight and report in his time zone.
And it should be available for you to take tomorrow.

> ops = dev_iommu_ops(idev->dev);
> if (!ops->hw_info) {
> data = ops->hw_info(idev->dev, &data_len, &cmd->out_data_type);

It should be:
if (ops->hw_info) {

Thanks
Nic