Commit 4381e2c3 authored by Wladimir J. van der Laan's avatar Wladimir J. van der Laan Committed by Greg Kroah-Hartman

drm/etnaviv: Fix off-by-one error in reloc checking

commit d6f756e0 upstream.

A relocation pointing to the last four bytes of a buffer can
legitimately happen in the case of small vertex buffers.
Signed-off-by: default avatarWladimir J. van der Laan <laanwj@gmail.com>
Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: default avatarChristian Gmeiner <christian.gmeiner@gmail.com>
Signed-off-by: default avatarLucas Stach <l.stach@pengutronix.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 00f3c2a2
...@@ -264,8 +264,8 @@ static int submit_reloc(struct etnaviv_gem_submit *submit, void *stream, ...@@ -264,8 +264,8 @@ static int submit_reloc(struct etnaviv_gem_submit *submit, void *stream,
if (ret) if (ret)
return ret; return ret;
if (r->reloc_offset >= bo->obj->base.size - sizeof(*ptr)) { if (r->reloc_offset > bo->obj->base.size - sizeof(*ptr)) {
DRM_ERROR("relocation %u outside object", i); DRM_ERROR("relocation %u outside object\n", i);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment