drm/etnaviv: Fix off-by-one error in reloc checking
Subsystems (2)
PATCH 1/1 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.
--- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +2 -2
@@ -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 ; }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 13 lines · Wladimir J. van der Laan
A relocation pointing to the last four bytes of a buffer can legitimately happen in the case of small vertex buffers.
Signed-off-by Wladimir J. van der Laan <[email protected]>--- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +0
-0
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c static int submit_reloc(struct etnaviv_gem_submit *submit, void *stream, · line 277
Quoted 10 lines
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +2
-2@@ -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 ; }
regards
Philipp
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
2017-07-25 14:33 GMT+02:00 Wladimir J. van der Laan <[email protected]>:
Quoted 4 lines
A relocation pointing to the last four bytes of a buffer can legitimately happen in the case of small vertex buffers.
Signed-off-by Wladimir J. van der Laan <[email protected]>
Quoted 20 lines
--- drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c +2
-3@@ -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 ; } --
Quoted 2 lines
2.7.4
greets
--
Christian Gmeiner, MSc
https://christian-gmeiner.info
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel