staging: comedi: allow buffer wraparound in comedi_write()
authorIan Abbott <abbotti@mev.co.uk>
Wed, 18 Nov 2015 17:55:08 +0000 (17:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Dec 2015 23:58:54 +0000 (15:58 -0800)
commit35a7475dc818320915e89ed0217872ff1ab66ec2
treeac14634755e673dee2339ecb6d79cc27007a8878
parent591c5f8a599a58c7c3773027010e537fc1d7a7d5
staging: comedi: allow buffer wraparound in comedi_write()

`comedi_write()` copies data from the user buffer to the acquisition
data buffer, which is cyclic, using a single call to `copy_from_user()`.
It currently avoids having to deal with wraparound of the cyclic buffer
by limiting the amount it copies (and the amount returned to the user).
Change it to deal with the wraparound using two calls to
`copy_from_user()` if necessary.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c