From 8e5241e631ce5a742d06d31b95f5b1c3025caaaa Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Wed, 12 Mar 2008 13:21:58 +0000 Subject: [PATCH] Prevent dereference of NULL chanlist pointer in ai cmdtest leading to kernel Oops. --- comedi/drivers/ni_labpc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/comedi/drivers/ni_labpc.c b/comedi/drivers/ni_labpc.c index f9afdc8a..d5baf94e 100644 --- a/comedi/drivers/ni_labpc.c +++ b/comedi/drivers/ni_labpc.c @@ -783,6 +783,10 @@ static enum scan_mode labpc_ai_scan_mode(const comedi_cmd * cmd) if (cmd->chanlist_len == 1) return MODE_SINGLE_CHAN; + /* chanlist may be NULL during cmdtest. */ + if (cmd->chanlist == NULL) + return MODE_MULT_CHAN_UP; + if (CR_CHAN(cmd->chanlist[0]) == CR_CHAN(cmd->chanlist[1])) return MODE_SINGLE_CHAN_INTERVAL; -- 2.26.2