aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-08-04 18:30:33 -0700
committerEric Anholt <[email protected]>2014-08-11 14:45:32 -0700
commitf5f8dd29c30e727c10ff087321d87c40c064de04 (patch)
treef8f3e97a6cb675cbb6c707411ec09c10743c82bf /src/gallium
parent0f034055f96b9dd7b1c54e8fa5422d22c26f2269 (diff)
vc4: Handle stride==0 in VBO validation
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/drivers/vc4/vc4_simulator_validate.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gallium/drivers/vc4/vc4_simulator_validate.c b/src/gallium/drivers/vc4/vc4_simulator_validate.c
index 421107a0b05..038de0fc637 100644
--- a/src/gallium/drivers/vc4/vc4_simulator_validate.c
+++ b/src/gallium/drivers/vc4/vc4_simulator_validate.c
@@ -942,18 +942,20 @@ validate_shader_rec(struct drm_device *dev,
stride |= (*(uint32_t *)(pkt_u + 100 + i * 4)) & ~0xff;
if (vbo->base.size < offset ||
- vbo->base.size - offset < attr_size ||
- stride == 0) {
+ vbo->base.size - offset < attr_size) {
DRM_ERROR("BO offset overflow (%d + %d > %d)\n",
offset, attr_size, vbo->base.size);
return -EINVAL;
}
- max_index = (vbo->base.size - offset - attr_size) / stride;
- if (state->max_index > max_index) {
- DRM_ERROR("primitives use index %d out of supplied %d\n",
- state->max_index, max_index);
- return -EINVAL;
+ if (stride != 0) {
+ max_index = ((vbo->base.size - offset - attr_size) /
+ stride);
+ if (state->max_index > max_index) {
+ DRM_ERROR("primitives use index %d out of supplied %d\n",
+ state->max_index, max_index);
+ return -EINVAL;
+ }
}
*(uint32_t *)(pkt_v + o) = vbo->paddr + offset;