Skip to content

Commit

Permalink
drm/etnaviv: Fix off-by-one error in reloc checking
Browse files Browse the repository at this point in the history
A relocation pointing to the last four bytes of a buffer can
legitimately happen in the case of small vertex buffers.

CC: [email protected] #4.9+
Signed-off-by: Wladimir J. van der Laan <[email protected]>
Reviewed-by: Philipp Zabel <[email protected]>
Reviewed-by: Christian Gmeiner <[email protected]>
Signed-off-by: Lucas Stach <[email protected]>
  • Loading branch information
laanwj authored and lynxeye-dev committed Aug 8, 2017
1 parent 5669b99 commit d6f756e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,8 @@ static int submit_reloc(struct etnaviv_gem_submit *submit, void *stream,
if (ret)
return ret;

if (r->reloc_offset >= bo->obj->base.size - sizeof(*ptr)) {
DRM_ERROR("relocation %u outside object", i);
if (r->reloc_offset > bo->obj->base.size - sizeof(*ptr)) {
DRM_ERROR("relocation %u outside object\n", i);
return -EINVAL;
}

Expand Down

0 comments on commit d6f756e

Please sign in to comment.