diff options
author | Rob Clark <[email protected]> | 2016-05-03 15:20:13 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2016-05-04 11:25:55 -0400 |
commit | e7c64041e9acda672982f2748bfc049dd3159682 (patch) | |
tree | b1a1af821bb4b5c8277830022543c1ad52d0d8cc /src/gallium | |
parent | 1f2bc64f31872f04c27f9aa7a93e63a0091aaabf (diff) |
freedreno: add some debug_asserts() to catch insane offsets
Ofc won't catch *all* faults, but at least helpful for catching offsets
which are completely bogus.
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_util.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h index 85dac982314..34b21a3d42d 100644 --- a/src/gallium/drivers/freedreno/freedreno_util.h +++ b/src/gallium/drivers/freedreno/freedreno_util.h @@ -207,6 +207,7 @@ OUT_RELOC(struct fd_ringbuffer *ring, struct fd_bo *bo, DBG("ring[%p]: OUT_RELOC %04x: %p+%u << %d", ring, (uint32_t)(ring->cur - ring->last_start), bo, offset, shift); } + debug_assert(offset < fd_bo_size(bo)); fd_ringbuffer_reloc(ring, &(struct fd_reloc){ .bo = bo, .flags = FD_RELOC_READ, @@ -224,6 +225,7 @@ OUT_RELOCW(struct fd_ringbuffer *ring, struct fd_bo *bo, DBG("ring[%p]: OUT_RELOCW %04x: %p+%u << %d", ring, (uint32_t)(ring->cur - ring->last_start), bo, offset, shift); } + debug_assert(offset < fd_bo_size(bo)); fd_ringbuffer_reloc(ring, &(struct fd_reloc){ .bo = bo, .flags = FD_RELOC_READ | FD_RELOC_WRITE, |