]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
staging: comedi: me4000: validate cmd->stop_arg in step 3 of (*do_cmdtest)
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 9 Sep 2014 23:15:49 +0000 (16:15 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Sep 2014 21:35:21 +0000 (14:35 -0700)
The async command arguments are supposed to be trivially validated in step 3
of the (*do_cmdtest). Fix the validation of the stop_arg.

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

index e600ce8653fd9679c6b0ee5021e5f1b2c9dc7baa..6561b00bea59bf6abdfd6fae234868800539fcef 100644 (file)
@@ -923,6 +923,11 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev,
                err |= -EINVAL;
        }
 
+       if (cmd->stop_src == TRIG_COUNT)
+               err |= cfc_check_trigger_arg_min(&cmd->stop_arg, 1);
+       else    /* TRIG_NONE */
+               err |= cfc_check_trigger_arg_is(&cmd->stop_arg, 0);
+
        if (err)
                return 3;
 
@@ -1029,13 +1034,6 @@ static int me4000_ai_do_cmd_test(struct comedi_device *dev,
                        err++;
                }
        }
-       if (cmd->stop_src == TRIG_COUNT) {
-               if (cmd->stop_arg == 0) {
-                       dev_err(dev->class_dev, "Invalid stop arg\n");
-                       cmd->stop_arg = 1;
-                       err++;
-               }
-       }
        if (cmd->scan_end_src == TRIG_COUNT) {
                if (cmd->scan_end_arg == 0) {
                        dev_err(dev->class_dev, "Invalid scan end arg\n");