[igt-dev] [RFC 2/4] tests/i915/gem_mmap: Add invalid parameters tests
Antonio Argenziano
antonio.argenziano at intel.com
Wed Mar 13 22:18:15 UTC 2019
On 12/03/19 15:02, Chris Wilson wrote:
> Quoting Antonio Argenziano (2019-03-12 21:57:36)
>> Add a couple of tests that supply invalid parameters to the mmap IOCTL.
>>
>> Signed-off-by: Antonio Argenziano <antonio.argenziano at intel.com>
>> ---
>> tests/i915/gem_mmap.c | 18 ++++++++++++++++++
>> 1 file changed, 18 insertions(+)
>>
>> diff --git a/tests/i915/gem_mmap.c b/tests/i915/gem_mmap.c
>> index 0ed15878..2a676b9a 100644
>> --- a/tests/i915/gem_mmap.c
>> +++ b/tests/i915/gem_mmap.c
>> @@ -136,6 +136,24 @@ igt_main
>> igt_assert(ret == -1 && errno == ENOENT);
>> }
>>
>> + igt_subtest("bad-offset") {
>> + memset(&arg, 0, sizeof(arg));
>> + arg.handle = gem_create(fd, 4096);
>> + arg.offset = 4096 + 1;
>> + arg.size = 4096;
>> + ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
>> + igt_assert(ret == -1 && errno == EINVAL);
>
> Also arg.offset = -size is a good one.
>
> Then size=8192 and arg.offset=-4096;
>
>> + }
>> +
>> + igt_subtest("bad-size") {
>> + memset(&arg, 0, sizeof(arg));
>> + arg.handle = gem_create(fd, 4096);
>> + arg.offset = 4096;
>> + arg.size = 0;
>> + ret = ioctl(fd, DRM_IOCTL_I915_GEM_MMAP, &arg);
>> + igt_assert(ret == -1 && errno == EINVAL);
>
> Also >4096, -4096
Hmmm, >4096 seems not to be returning an error. Where should it be
checked against the size of the object?
Antonio
> -Chris
>
More information about the igt-dev
mailing list