[PATCH 8/8] pcmcia: handle __copy_from_user() return value in ioctl
Randy Dunlap
randy.dunlap at oracle.com
Sun Nov 19 13:09:26 EST 2006
Dominik Brodowski wrote:
> From: Dominik Brodowski <linux at dominikbrodowski.net>
> Date: Sun, 19 Nov 2006 11:21:27 -0500
> Subject: [PATCH] pcmcia: handle __copy_from_user() return value in ioctl
>
> Handle __copy_from_user() return value.
>
> drivers/pcmcia/pcmcia_ioctl.c:597: warning: ignoring return value of '__copy_from_user', declared with attribute warn_unused_result
>
> Noticed and first fix by Randy Dunlap.
>
> Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>
> ---
> drivers/pcmcia/pcmcia_ioctl.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
> index 310ede5..6383a39 100644
> --- a/drivers/pcmcia/pcmcia_ioctl.c
> +++ b/drivers/pcmcia/pcmcia_ioctl.c
> @@ -594,7 +594,12 @@ static int ds_ioctl(struct inode * inode
>
> err = ret = 0;
>
> - if (cmd & IOC_IN) __copy_from_user((char *)buf, uarg, size);
> + if (cmd & IOC_IN) {
> + if (__copy_from_user((char *)buf, uarg, size)) {
> + ret = -EFAULT;
Ack, except:
s/ret/err/
since free_out: returns err;
> + goto free_out;
> + }
> + }
>
> switch (cmd) {
> case DS_ADJUST_RESOURCE_INFO:
--
~Randy
More information about the linux-pcmcia
mailing list