[PATCH] gpu: host1x: Fix syncpt array index check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The index overflow check in host1x_syncpt_get was incorrect,
and would return a pointer past the syncpt array if the
syncpt index given was the total number of syncpts. Fix
this.

Signed-off-by: Mikko Perttunen <mperttunen@xxxxxxxxxx>
---
 drivers/gpu/host1x/syncpt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/host1x/syncpt.c b/drivers/gpu/host1x/syncpt.c
index 25c11a85050b..3236c3d21a15 100644
--- a/drivers/gpu/host1x/syncpt.c
+++ b/drivers/gpu/host1x/syncpt.c
@@ -484,10 +484,10 @@ 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 host->syncpt + id;
+	else
 		return NULL;
-
-	return host->syncpt + id;
 }
 EXPORT_SYMBOL(host1x_syncpt_get);
 
-- 
2.11.1

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux