[PATCH] check the return value of __copy_to_user indrivers/pcmcia/ds.c::ds_ioctl and return -EFAULT if it fails

From: Jesper Juhl
Date: Tue Oct 05 2004 - 17:15:54 EST



CC drivers/pcmcia/ds.o
include/asm/uaccess.h: In function `ds_ioctl':
drivers/pcmcia/ds.c:1049: warning: ignoring return value of `__copy_to_user', declared with attribute warn_unused_result

Patch adds a check of the return value and returns -EFAULT if
__copy_to_user fails.

Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>

diff -up linux-2.6.9-rc3-bk5-orig/drivers/pcmcia/ds.c linux-2.6.9-rc3-bk5/drivers/pcmcia/ds.c
--- linux-2.6.9-rc3-bk5-orig/drivers/pcmcia/ds.c 2004-10-05 22:07:27.000000000 +0200
+++ linux-2.6.9-rc3-bk5/drivers/pcmcia/ds.c 2004-10-06 00:12:20.000000000 +0200
@@ -1046,7 +1046,11 @@ static int ds_ioctl(struct inode * inode
}
}

- if (cmd & IOC_OUT) __copy_to_user(uarg, (char *)&buf, size);
+ if (cmd & IOC_OUT) {
+ if (__copy_to_user(uarg, (char *)&buf, size))
+ err = -EFAULT;
+ }
+

return err;
} /* ds_ioctl */


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/