OSDN Git Service

staging: comedi: change do_insn*_ioctl to allow more samples
authorSpencer E. Olson <olsonse@umich.edu>
Tue, 4 Dec 2018 19:07:50 +0000 (12:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Dec 2018 10:37:58 +0000 (11:37 +0100)
commitf8bc1b2efa05183f10451b7618243a4278bf6b16
treebb216ea4cc182b4bf1408c0fb998c91a7a7da038
parent354ea2ee6d2bc08d2f73b67096e67760089887cb
staging: comedi: change do_insn*_ioctl to allow more samples

Changes do_insn*_ioctl functions to allow for data lengths for each
comedi_insn of up to 2^16.  This patch also changes these functions to only
allocate as much memory as is necessary for each comedi_insn, rather than
allocating a fixed-sized scratch space.

In testing some user-space code for the new INSN_DEVICE_CONFIG_GET_ROUTES
facility with some newer hardware, I discovered that do_insn_ioctl and
do_insnlist_ioctl limited the amount of data that can be passed into the
kernel for insn's to a length of 256.  For some newer hardware, the number
of routes can be greater than 1000.  Working around the old limits (256)
would complicate the user-space/kernel interaction.

The new upper limit is reasonable with current memory available and does
not otherwise impact the memory footprint for any current or otherwise
typical configuration.

Signed-off-by: Spencer E. Olson <olsonse@umich.edu>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c