* [patch] fbmem: return -EFAULT on copy_to_user() failure
@ 2012-11-12 11:08 Dan Carpenter
2013-06-18 7:05 ` Dan Carpenter
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2012-11-12 11:08 UTC (permalink / raw)
To: Florian Tobias Schandinat; +Cc: linux-fbdev, linux-kernel, kernel-janitors
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>
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 3ff0105..3d2a4d0 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -1302,8 +1302,9 @@ static int do_fscreeninfo_to_user(struct fb_fix_screeninfo *fix,
err |= put_user(fix->accel, &fix32->accel);
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,
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [patch] fbmem: return -EFAULT on copy_to_user() failure
2012-11-12 11:08 [patch] fbmem: return -EFAULT on copy_to_user() failure Dan Carpenter
@ 2013-06-18 7:05 ` Dan Carpenter
2013-06-26 13:04 ` Tomi Valkeinen
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2013-06-18 7:05 UTC (permalink / raw)
To: Jean-Christophe Plagniol-Villard
Cc: Tomi Valkeinen, linux-fbdev, linux-kernel, kernel-janitors
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>
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
index 098bfc6..9217be3 100644
--- a/drivers/video/fbmem.c
+++ b/drivers/video/fbmem.c
@@ -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,
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] fbmem: return -EFAULT on copy_to_user() failure
2013-06-18 7:05 ` Dan Carpenter
@ 2013-06-26 13:04 ` Tomi Valkeinen
0 siblings, 0 replies; 3+ messages in thread
From: Tomi Valkeinen @ 2013-06-26 13:04 UTC (permalink / raw)
To: Dan Carpenter
Cc: Jean-Christophe Plagniol-Villard, linux-fbdev, linux-kernel,
kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 898 bytes --]
On 18/06/13 10:05, Dan Carpenter wrote:
> 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>
>
> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
> index 098bfc6..9217be3 100644
> --- a/drivers/video/fbmem.c
> +++ b/drivers/video/fbmem.c
> @@ -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,
I've added this to fbdev-3.11 branch.
Tomi
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-06-26 13:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-12 11:08 [patch] fbmem: return -EFAULT on copy_to_user() failure Dan Carpenter
2013-06-18 7:05 ` Dan Carpenter
2013-06-26 13:04 ` Tomi Valkeinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).