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>
This commit is contained in:
Thierry Reding 2017-03-09 20:04:57 +01:00
Родитель 05d2f3ea0d
Коммит 8cadb01d2c
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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;