* [PATCH] staging: comedi: ni_at_a2150: range check board index
@ 2014-09-01 13:13 ` Ian Abbott
0 siblings, 0 replies; 4+ messages in thread
From: Ian Abbott @ 2014-09-01 13:13 UTC (permalink / raw)
To: driverdev-devel
Cc: Greg Kroah-Hartman, Ian Abbott, H Hartley Sweeten, linux-kernel
The "ni_at_a2150" driver determines the board type by calling
`a2150_probe()`. This reads a register and converts it to a board index
in the range 0 to 3. However, the board table array it indexes into
(`a2150_boards[]`) only has 2 entries. Return an error from the
Comedi driver "attach" handler `a2150_attach()` if the probed board
index is beyond the end of the array.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
drivers/staging/comedi/drivers/ni_at_a2150.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c
index de67161..32e7bf2 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -705,7 +705,11 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (ret)
return ret;
- dev->board_ptr = a2150_boards + a2150_probe(dev);
+ i = a2150_probe(dev);
+ if (i >= ARRAY_SIZE(a2150_boards))
+ return -ENODEV;
+
+ dev->board_ptr = a2150_boards + i;
thisboard = comedi_board(dev);
dev->board_name = thisboard->name;
--
2.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] staging: comedi: ni_at_a2150: range check board index
@ 2014-09-01 13:13 ` Ian Abbott
0 siblings, 0 replies; 4+ messages in thread
From: Ian Abbott @ 2014-09-01 13:13 UTC (permalink / raw)
To: driverdev-devel; +Cc: Greg Kroah-Hartman, Ian Abbott, linux-kernel
The "ni_at_a2150" driver determines the board type by calling
`a2150_probe()`. This reads a register and converts it to a board index
in the range 0 to 3. However, the board table array it indexes into
(`a2150_boards[]`) only has 2 entries. Return an error from the
Comedi driver "attach" handler `a2150_attach()` if the probed board
index is beyond the end of the array.
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
---
drivers/staging/comedi/drivers/ni_at_a2150.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c
index de67161..32e7bf2 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -705,7 +705,11 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
if (ret)
return ret;
- dev->board_ptr = a2150_boards + a2150_probe(dev);
+ i = a2150_probe(dev);
+ if (i >= ARRAY_SIZE(a2150_boards))
+ return -ENODEV;
+
+ dev->board_ptr = a2150_boards + i;
thisboard = comedi_board(dev);
dev->board_name = thisboard->name;
--
2.0.4
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] staging: comedi: ni_at_a2150: range check board index
2014-09-01 13:13 ` Ian Abbott
@ 2014-09-03 17:03 ` Hartley Sweeten
-1 siblings, 0 replies; 4+ messages in thread
From: Hartley Sweeten @ 2014-09-03 17:03 UTC (permalink / raw)
To: Ian Abbott, driverdev-devel; +Cc: Greg Kroah-Hartman, linux-kernel
On Monday, September 01, 2014 6:14 AM, Ian Abbott wrote:
> The "ni_at_a2150" driver determines the board type by calling
> `a2150_probe()`. This reads a register and converts it to a board index
> in the range 0 to 3. However, the board table array it indexes into
> (`a2150_boards[]`) only has 2 entries. Return an error from the
> Comedi driver "attach" handler `a2150_attach()` if the probed board
> index is beyond the end of the array.
>
> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] staging: comedi: ni_at_a2150: range check board index
@ 2014-09-03 17:03 ` Hartley Sweeten
0 siblings, 0 replies; 4+ messages in thread
From: Hartley Sweeten @ 2014-09-03 17:03 UTC (permalink / raw)
To: Ian Abbott, driverdev-devel; +Cc: Greg Kroah-Hartman, linux-kernel
On Monday, September 01, 2014 6:14 AM, Ian Abbott wrote:
> The "ni_at_a2150" driver determines the board type by calling
> `a2150_probe()`. This reads a register and converts it to a board index
> in the range 0 to 3. However, the board table array it indexes into
> (`a2150_boards[]`) only has 2 entries. Return an error from the
> Comedi driver "attach" handler `a2150_attach()` if the probed board
> index is beyond the end of the array.
>
> Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-09-03 17:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-01 13:13 [PATCH] staging: comedi: ni_at_a2150: range check board index Ian Abbott
2014-09-01 13:13 ` Ian Abbott
2014-09-03 17:03 ` Hartley Sweeten
2014-09-03 17:03 ` Hartley Sweeten
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.