On Sun, Oct 15, 2023 at 12:46:48AM -0700, Nicolin Chen wrote:
> TEST_LENGTH passing ".size = sizeof(struct _struct) - 1" expects -EINVAL
> from "if (ucmd.user_size < op->min_size)" check in iommufd_fops_ioctl().
> This has been working when min_size is exactly the size of the structure.
> 
> However, if the size of the structure becomes larger than min_size, i.e.
> the passing size above is larger than min_size, that min_size sanity no
> longer works.
> 
> Since the first test in TEST_LENGTH() was to test that min_size sanity
> routine, rework it to support a min_size calculation, rather than using
> the full size of the structure.
> 
> Signed-off-by: Nicolin Chen <[email protected]>
> ---
> Hi Jason/Kevin,
> 
> This was a part of the nesting series. Its link in v4:
> https://lore.kernel.org/linux-iommu/[email protected]/
> 
> I just realized that this should go in prior to the nesting series.
> One of the nesting patches changes the IOMMU_HWPT_ALLOC structure,
> which would break the cmd_length test without this patch.
> 
> Thanks!
> Nicolin
> 
>  tools/testing/selftests/iommu/iommufd.c | 29 ++++++++++++++-----------
>  1 file changed, 16 insertions(+), 13 deletions(-)

Applied to iommufd for-next

Thanks,
Jason

Reply via email to