Commit eabd4390 authored by Simon Ser's avatar Simon Ser

tests/i915/gen_mmap: fix no-op loops

The loop condition is never satisfied, since after filling the array i > 0. For
this reason the loop is always a no-op.

Use a more conventional loop instead.

Fixes: 964e3915 ("tests/i915/gem_mmap: Add invalid parameters tests")
Signed-off-by: Simon Ser's avatarSimon Ser <simon.ser@intel.com>
Acked-by: Antonio Argenziano's avatarAntonio Argenziano <antonio.argenziano@intel.com>
Reviewed-by: Arkadiusz Hiler's avatarArkadiusz Hiler <arkadiusz.hiler@intel.com>
parent 4f2b9f59
......@@ -158,14 +158,15 @@ igt_main
igt_subtest("bad-object") {
uint32_t real_handle = gem_create(fd, 4096);
uint32_t handles[20];
int i = 0;
size_t i = 0, len;
handles[i++] = 0xdeadbeef;
for(int bit = 0; bit < 16; bit++)
handles[i++] = real_handle | (1 << (bit + 16));
handles[i] = real_handle + 1;
handles[i++] = real_handle + 1;
len = i;
for (; i < 0; i--) {
for (i = 0; i < len; ++i) {
struct drm_i915_gem_mmap arg = {
.handle = handles[i],
.size = 4096,
......
......@@ -886,14 +886,15 @@ igt_main
igt_subtest("bad-object") {
uint32_t real_handle = gem_create(fd, 4096);
uint32_t handles[20];
int i = 0;
size_t i = 0, len;
handles[i++] = 0xdeadbeef;
for(int bit = 0; bit < 16; bit++)
handles[i++] = real_handle | (1 << (bit + 16));
handles[i] = real_handle + 1;
handles[i++] = real_handle + 1;
len = i;
for (; i < 0; i--) {
for (i = 0; i < len; ++i) {
struct drm_i915_gem_mmap_gtt arg = {
.handle = handles[i],
};
......
......@@ -496,14 +496,15 @@ igt_main
igt_subtest("bad-object") {
uint32_t real_handle = gem_create(fd, 4096);
uint32_t handles[20];
int i = 0;
size_t i = 0, len;
handles[i++] = 0xdeadbeef;
for(int bit = 0; bit < 16; bit++)
handles[i++] = real_handle | (1 << (bit + 16));
handles[i] = real_handle + 1;
handles[i++] = real_handle + 1;
len = i;
for (; i < 0; i--) {
for (i = 0; i < len; ++i) {
struct drm_i915_gem_mmap arg = {
.handle = handles[i],
.size = 4096,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment