Skip to content

Commit

Permalink
fbmem: return -EFAULT on copy_to_user() failure
Browse files Browse the repository at this point in the history
copy_to_user() returns the number of bytes remaining to be copied.
put_user() returns -EFAULT on error.

This function ORs a bunch of stuff together and returns jumbled non-zero
values on error.  It should return -EFAULT.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
  • Loading branch information
Dan Carpenter authored and Tomi Valkeinen committed Jun 26, 2013
1 parent 72e5512 commit 2c30aba
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/video/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1305,7 +1305,9 @@ static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix,
err |= copy_to_user(fix32->reserved, fix->reserved,
sizeof(fix->reserved));

return err;
if (err)
return -EFAULT;
return 0;
}

static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd,
Expand Down

0 comments on commit 2c30aba

Please sign in to comment.