summaryrefslogtreecommitdiff
path: root/tests/gem_reset_stats.c
diff options
context:
space:
mode:
authorMika Kuoppala <mika.kuoppala@intel.com>2014-04-10 17:51:39 +0300
committerMika Kuoppala <mika.kuoppala@intel.com>2014-04-10 17:53:08 +0300
commit99b8f807010483128f10f7934a864c78b4438b34 (patch)
tree7e615027c180fc3ff6109603adc2424e0898df2d /tests/gem_reset_stats.c
parent53ad1e4a7040c57355b57fc3cdc8d9a003687a32 (diff)
tests/gem_reset_stats: fix length check in inject_hang
To avoid writing past the batch end. Signed-off-by: Mika Kuoppala <mika.kuoppala@intel.com>
Diffstat (limited to 'tests/gem_reset_stats.c')
-rw-r--r--tests/gem_reset_stats.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/gem_reset_stats.c b/tests/gem_reset_stats.c
index c69059bc..c2277987 100644
--- a/tests/gem_reset_stats.c
+++ b/tests/gem_reset_stats.c
@@ -295,7 +295,7 @@ static int inject_hang_ring(int fd, int ctx, int ring, bool ignore_ban_error)
for (i = 0; i < ITEMS; i++)
buf[i] = MI_NOOP;
- roff = random() % (ITEMS - cmd_len);
+ roff = random() % (ITEMS - cmd_len - 1);
buf[roff] = MI_BATCH_BUFFER_START | (cmd_len - 2);
buf[roff + 1] = (gtt_off & 0xfffffffc) + (roff << 2);
if (cmd_len == 3)