gpu: host1x: Fix memory access in syncpt request
authorArto Merilainen <amerilainen@nvidia.com>
Wed, 29 May 2013 10:26:06 +0000 (13:26 +0300)
committerThierry Reding <thierry.reding@gmail.com>
Sat, 22 Jun 2013 10:43:54 +0000 (12:43 +0200)
This patch fixes a bad memory access in syncpoint request code. If
no syncpoints were available, the code accessed unreserved memory
area causing unexpected behaviour.

Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Acked-By: Terje Bergstrom <tbergstrom@nvidia.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
drivers/gpu/host1x/syncpt.c

index 4b493453e805228c8b67ad1ff602c0f87e4b55b1..2b03f1b5cc5a0c1c6c39f6cd9b293691aa9e8779 100644 (file)
@@ -40,7 +40,8 @@ static struct host1x_syncpt *_host1x_syncpt_alloc(struct host1x *host,
 
        for (i = 0; i < host->info->nb_pts && sp->name; i++, sp++)
                ;
-       if (sp->dev)
+
+       if (i >= host->info->nb_pts)
                return NULL;
 
        name = kasprintf(GFP_KERNEL, "%02d-%s", sp->id,