Re: [PATCH v1 7/7] iommufd/selftest: Cover invalid read counts on vEVENTQ FD

From: Pranjal Shrivastava

Date: Wed Jun 03 2026 - 11:23:53 EST


On Mon, Jun 01, 2026 at 01:42:38PM -0700, Nicolin Chen wrote:
> The vEVENTQ file descriptor must reject reads whose buffer cannot hold
> even one event record. Add selftest coverage that exercises both the
> empty-queue path (the upfront size check) and the non-empty path (the
> in-loop check that fires only after an event is fetched).
>
> For iommufd_veventq_fops_read():
> - count == 0 and count < sizeof(header) on an empty vEVENTQ both
> return -EINVAL.
> - count == 0 and count == sizeof(header) on a non-empty vEVENTQ
> (event has trailing payload) both return -EINVAL.
>
> Assisted-by: Claude:claude-opus-4-7
> Signed-off-by: Nicolin Chen <nicolinc@xxxxxxxxxx>

Reviewed-by: Pranjal Shrivastava <praan@xxxxxxxxxx>

Thanks,
Praan