Am Montag, 18. November 2002 15:29 schrieb Rob Miller:
> Hi,
>
> erm, my driver seems to be escaping into the wild, probably time to check
> in and get some things right before it gets too far... honest, I just put
> it on my website without any effort at advertising for people to find on
> their own, but this morning someone pointed out that it was on
> openchallenge.org, I e-mailed the site and now I hear I might get more
> traffic....
OK, here we go.
case CPAD_CGID:
up (&dev->sem);
if ((retval = put_user(dev->idev.idbus, ((short *) arg) + 0))) return
retval;
if ((retval = put_user(dev->idev.idvendor, ((short *) arg) + 1))) return
retval;
if ((retval = put_user(dev->idev.idproduct, ((short *) arg) + 2))) return
retval;
if ((retval = put_user(dev->idev.idversion, ((short *) arg) + 3))) return
retval;
return 0;
- Race condition. You must drop the lock only after the last put_user
/* see if we are already in the middle of a write */
if (dev->write_urb->status == -EINPROGRESS) {
dbg (__FUNCTION__ " - already writing");
goto exit;
}
- Bad. Wait for completion in that case, or, if you are opened non blocking,
return the right error code
for (i=bytes_written,wcount=2;i>1 && wcount<CPAD_BUFMAX;)
((char *) dev->write_urb->transfer_buffer)[wcount++] = tmpbuf[--i];
- You might better copy into the buffer in first place instead of another copy
unsigned char mdata[8]; /* cpad mouse input buffer */
- You must not do that. You violate DMA requirements on some architectures.
Allocate the buffer sperately with kmalloc.
HTH
Oliver
-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing
your web site with SSL, click here to get a FREE TRIAL of a Thawte
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel