staging: comedi: Check length of INSN_CONFIG_TIMER_1 instruction
authorIan Abbott <abbotti@mev.co.uk>
Tue, 30 Oct 2018 14:17:13 +0000 (14:17 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Nov 2018 12:05:39 +0000 (13:05 +0100)
The contents of the Comedi configuration instruction
`INSN_CONFIG_TIMER_1` instruction are not very well defined, but the one
driver that uses it (the "cb_pcidas64" driver for the PCI-DAS4020/12
card) assumes its `insn->n` is 5. Add a check in
`check_insn_config_length()` to verify that `insn->n` is correct for
this configuration instruction.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/comedi_fops.c

index c1c6b2b4ab91c5cc67165ec0179c997c887bc10f..ceb6ba5dd57c852ff27573275d09c8421c7a625f 100644 (file)
@@ -1209,6 +1209,7 @@ static int check_insn_config_length(struct comedi_insn *insn,
                break;
        case INSN_CONFIG_PWM_OUTPUT:
        case INSN_CONFIG_ANALOG_TRIG:
+       case INSN_CONFIG_TIMER_1:
                if (insn->n == 5)
                        return 0;
                break;