summaryrefslogtreecommitdiff
path: root/drivers/gpu/host1x
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2017-03-09 22:04:57 +0300
committerThierry Reding <treding@nvidia.com>2017-04-04 20:18:47 +0300
commit8cadb01d2c2f520a890d1bc78b45471f21b9b76d (patch)
tree749035104a97b75397e2225f1bb560fcb51e925d /drivers/gpu/host1x
parent05d2f3ea0dbf0785ab6875a1494cf2f886fa50cd (diff)
downloadlinux-8cadb01d2c2f520a890d1bc78b45471f21b9b76d.tar.xz
gpu: host1x: Fix potential out-of-bounds access
The check for valid syncpoint IDs is off by one. While at it, rewrite the check to make it more easily understandable. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/host1x')
-rw-r--r--drivers/gpu/host1x/syncpt.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
index 25c11a85050b..0ac026cdc30c 100644
--- a/drivers/gpu/host1x/syncpt.c
+++ b/drivers/gpu/host1x/syncpt.c
@@ -484,7 +484,7 @@ unsigned int host1x_syncpt_nb_mlocks(struct host1x *host)
struct host1x_syncpt *host1x_syncpt_get(struct host1x *host, unsigned int id)
{
- if (host->info->nb_pts < id)
+ if (id >= host->info->nb_pts)
return NULL;
return host->syncpt + id;