[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

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux