Skip to contentSkip to conversation

gpu: host1x: Fix syncpt array index check

PATCH New Mikko Perttunen 1 participant 1 message Mar 7, 2017

Subsystems (3)
lore
Share & tools
lore

Mikko Perttunen

author maintainer
#0 lore raw

PATCH 1/1 gpu: host1x: Fix syncpt array index check

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.

---
 drivers/gpu/host1x/syncpt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/host1x/syncpt.c +3 -3
index 25c11a85050b..3236c3d21a15 100644
@@ -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);
 
Signature · 6 lines
2.11.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel