staging: comedi: comedi_test: limit maximum convert_arg
authorIan Abbott <abbotti@mev.co.uk>
Tue, 27 Oct 2015 16:59:13 +0000 (16:59 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Oct 2015 23:58:36 +0000 (08:58 +0900)
commit5afdcad2f818ed623f61e79ea63fcd347bef1a8c
treefb22d594706a53a842a360245cb954703893319b
parent87f64803ca9fc4d4748a648a69532dcb52f7fc6a
staging: comedi: comedi_test: limit maximum convert_arg

When testing the parameters for setting up an asynchronous command on
the AI subdevice, limit the maximum conversion period
(`cmd->convert_arg`) so that the number of conversions in a scan
(`cmd->scan_end_arg`, same as `cmd->chanlist_len`) multiplied by the
conversion period fits within an `unsigned int`, as that is used to
limit the minimum scan period (`cmd->scan_begin_arg`).

Also ensure rounding of the conversion period and scan period to the
nearest microsecond both fit in an `unsigned int`.  Do all this in stage
4 ("fix up any arguments") of the command testing.

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/drivers/comedi_test.c