Skip to content

Commit

Permalink
gpu: host1x: Fix potential out-of-bounds access
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thierry Reding committed Apr 4, 2017
1 parent 05d2f3e commit 8cadb01
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/gpu/host1x/syncpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8cadb01

Please sign in to comment.