Skip to content

Commit

Permalink
drm/nouveau/disp: sizeof() wrong pointer
Browse files Browse the repository at this point in the history
"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>
  • Loading branch information
Dan Carpenter authored and Ben Skeggs committed Feb 20, 2013
1 parent 264ce19 commit af1ac18
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/nouveau/core/engine/disp/nv50.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/nouveau/core/engine/disp/nvd0.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit af1ac18

Please sign in to comment.