On Thu, Jan 13, 2005 at 11:44:44PM +0100, Florian Echtler wrote:
> > I've applied your driver as is to the tree, and then fixed up some
> > sparse warnings that were found with it (__user and le16_to_cpu() needed
> > to be added in places.)
> Thanks! Could you perhaps send me the updated version? I didn't notice
> any warnings when I compiled it with my 2.6.10 kernel..

Did you try building it with sparse?  It should have showed you the
__user warning.

I fixed that, and in the 2.6.11-rc1 kernel, the endianess (is that a
word?) of some of the usb device structures have been made little
endian.  I've fixed the driver to handle that properly.

The patch I applied is below.

thanks,

greg k-h

----

# Subject: USB: fix sparse warnings in the idmouse.c driver
#
# Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>

diff -Nru a/drivers/usb/misc/idmouse.c b/drivers/usb/misc/idmouse.c
--- a/drivers/usb/misc/idmouse.c        2005-01-13 15:47:04 -08:00
+++ b/drivers/usb/misc/idmouse.c        2005-01-13 15:47:04 -08:00
@@ -67,7 +67,7 @@
 };
 
 /* local function prototypes */
-static ssize_t idmouse_read(struct file *file, char *buffer,
+static ssize_t idmouse_read(struct file *file, char __user *buffer,
                                size_t count, loff_t * ppos);
 
 static int idmouse_open(struct inode *inode, struct file *file);
@@ -274,7 +274,7 @@
        return 0;
 }
 
-static ssize_t idmouse_read(struct file *file, char *buffer, size_t count,
+static ssize_t idmouse_read(struct file *file, char __user *buffer, size_t 
count,
                                loff_t * ppos)
 {
        struct usb_idmouse *dev;
@@ -343,7 +343,7 @@
                USB_ENDPOINT_XFER_BULK)) {
 
                /* we found a bulk in endpoint */
-               buffer_size = endpoint->wMaxPacketSize;
+               buffer_size = le16_to_cpu(endpoint->wMaxPacketSize);
                dev->bulk_in_size = buffer_size;
                dev->bulk_in_endpointAddr = endpoint->bEndpointAddress;
                dev->bulk_in_buffer =


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to