drm/nouveau/disp: sizeof() wrong pointer
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 23 Jan 2013 08:27:56 +0000 (11:27 +0300)
committerBen Skeggs <bskeggs@redhat.com>
Wed, 20 Feb 2013 06:00:54 +0000 (16:00 +1000)
"data" is a void pointer and "args" is "data" after we have casted it to
a struct.  We care about the size of the struct here.  Btw,
sizeof(*data) is 1.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c

index 0d26f00a2f15a3f20a5aa77b73f208c4596f837e..78f09c3dff1fe61dfeb3931e21527b7d68c4e579 100644 (file)
@@ -333,7 +333,7 @@ nv50_disp_sync_ctor(struct nouveau_object *parent,
        struct nv50_disp_dmac *dmac;
        int ret;
 
-       if (size < sizeof(*data) || args->head > 1)
+       if (size < sizeof(*args) || args->head > 1)
                return -EINVAL;
 
        ret = nv50_disp_dmac_create_(parent, engine, oclass, args->pushbuf,
@@ -372,7 +372,7 @@ nv50_disp_ovly_ctor(struct nouveau_object *parent,
        struct nv50_disp_dmac *dmac;
        int ret;
 
-       if (size < sizeof(*data) || args->head > 1)
+       if (size < sizeof(*args) || args->head > 1)
                return -EINVAL;
 
        ret = nv50_disp_dmac_create_(parent, engine, oclass, args->pushbuf,
index 74626e8c020b7193826a8bfaf055a2ba091b87bc..44618993661294409e21ff178d7caaab8616c97c 100644 (file)
@@ -228,7 +228,7 @@ nvd0_disp_sync_ctor(struct nouveau_object *parent,
        struct nv50_disp_dmac *dmac;
        int ret;
 
-       if (size < sizeof(*data) || args->head >= priv->head.nr)
+       if (size < sizeof(*args) || args->head >= priv->head.nr)
                return -EINVAL;
 
        ret = nv50_disp_dmac_create_(parent, engine, oclass, args->pushbuf,
@@ -268,7 +268,7 @@ nvd0_disp_ovly_ctor(struct nouveau_object *parent,
        struct nv50_disp_dmac *dmac;
        int ret;
 
-       if (size < sizeof(*data) || args->head >= priv->head.nr)
+       if (size < sizeof(*args) || args->head >= priv->head.nr)
                return -EINVAL;
 
        ret = nv50_disp_dmac_create_(parent, engine, oclass, args->pushbuf,