From: Simon Ser <simon.ser@intel.com>
To: igt-dev@lists.freedesktop.org
Subject: [igt-dev] [PATCH i-g-t] tests/i915/gen_mmap: fix no-op loops
Date: Tue, 7 May 2019 15:44:41 +0300 [thread overview]
Message-ID: <20190507124441.18976-1-simon.ser@intel.com> (raw)
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: 964e39159c64 ("tests/i915/gem_mmap: Add invalid parameters tests")
Signed-off-by: Simon Ser <simon.ser@intel.com>
Cc: Antonio Argenziano <antonio.argenziano@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
tests/i915/gem_mmap.c | 7 ++++---
tests/i915/gem_mmap_gtt.c | 7 ++++---
tests/i915/gem_mmap_wc.c | 7 ++++---
3 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/tests/i915/gem_mmap.c b/tests/i915/gem_mmap.c
index d1b10013a1b8..c96aa2c0a7a5 100644
--- a/tests/i915/gem_mmap.c
+++ b/tests/i915/gem_mmap.c
@@ -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,
diff --git a/tests/i915/gem_mmap_gtt.c b/tests/i915/gem_mmap_gtt.c
index 9a670f030149..034658e64990 100644
--- a/tests/i915/gem_mmap_gtt.c
+++ b/tests/i915/gem_mmap_gtt.c
@@ -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],
};
diff --git a/tests/i915/gem_mmap_wc.c b/tests/i915/gem_mmap_wc.c
index 159eedbf4cfb..63538f791aae 100644
--- a/tests/i915/gem_mmap_wc.c
+++ b/tests/i915/gem_mmap_wc.c
@@ -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,
--
2.21.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
next reply other threads:[~2019-05-07 12:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 12:44 Simon Ser [this message]
2019-05-07 13:54 ` [igt-dev] ✓ Fi.CI.BAT: success for tests/i915/gen_mmap: fix no-op loops Patchwork
2019-05-07 14:31 ` [igt-dev] [PATCH i-g-t] " Chris Wilson
2019-05-07 15:10 ` Ser, Simon
2019-05-08 11:27 ` Jani Nikula
2019-05-07 18:42 ` [igt-dev] ✗ Fi.CI.IGT: failure for " Patchwork
2019-05-08 9:54 ` Ser, Simon
2019-05-20 6:26 ` Ser, Simon
2019-05-27 15:25 ` Ser, Simon
2019-05-31 11:36 ` Ser, Simon
2019-05-31 11:41 ` Chris Wilson
2019-05-31 11:52 ` Ser, Simon
2019-06-03 15:18 ` Daniel Vetter
2019-05-10 15:39 ` [igt-dev] [PATCH i-g-t] " Antonio Argenziano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190507124441.18976-1-simon.ser@intel.com \
--to=simon.ser@intel.com \
--cc=igt-dev@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox