[igt-dev] [PATCH i-g-t 1/2] i915/gem_mmap_offset: Check mapping availability

Kamil Konieczny kamil.konieczny at linux.intel.com
Wed Jan 11 16:46:03 UTC 2023


On 2023-01-11 at 11:26:32 +0100, Zbigniew Kempczyński wrote:
> When we pass invalid handles to GEM_MMAP_OFFSET ioctl we should check
> return error code only for supported mapping types. Use real handle
> to verify kernel supports such mapping type.
> 
> Signed-off-by: Chris Wilson <chris.p.wilson at linux.intel.com>
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski at intel.com>

Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>

> ---
>  tests/i915/gem_mmap_offset.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/i915/gem_mmap_offset.c b/tests/i915/gem_mmap_offset.c
> index b27920de2e..b38b7edae3 100644
> --- a/tests/i915/gem_mmap_offset.c
> +++ b/tests/i915/gem_mmap_offset.c
> @@ -190,12 +190,17 @@ static void bad_object(int i915)
>  	for (; i >= 0; i--) {
>  		for_each_mmap_offset_type(i915, t) {
>  			struct drm_i915_gem_mmap_offset arg = {
> -				.handle = handles[i],
> +				.handle = real_handle,
>  				.flags = t->type,
>  			};
>  
> +			if (mmap_offset_ioctl(i915, &arg))
> +				continue;
> +
>  			igt_debug("Trying MMAP IOCTL[%s] with handle %x\n",
>  				  t->name, handles[i]);
> +
> +			arg.handle = handles[i];
>  			igt_assert_eq(mmap_offset_ioctl(i915, &arg),
>  				      -ENOENT);
>  		}
> -- 
> 2.34.1
> 


More information about the igt-dev mailing list