summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-07-25 14:33:36 +0200
committerLucas Stach <l.stach@pengutronix.de>2017-08-08 15:56:00 +0200
commitd6f756e09f01ea7a0efbbcef269a1e384a35d824 (patch)
treebb8aa5b70f25f97725232abf2f65fd28e529511b /drivers/gpu/drm
parentMerge branch 'drm-fixes-4.13' of git://people.freedesktop.org/~agd5f/linux in... (diff)
downloadlinux-d6f756e09f01ea7a0efbbcef269a1e384a35d824.tar.xz
linux-d6f756e09f01ea7a0efbbcef269a1e384a35d824.zip
drm/etnaviv: Fix off-by-one error in reloc checking
A relocation pointing to the last four bytes of a buffer can legitimately happen in the case of small vertex buffers. CC: stable@vger.kernel.org #4.9+ Signed-off-by: Wladimir J. van der Laan <laanwj@gmail.com> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
index 5bd93169dac2..6463fc2c736f 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
@@ -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;
}