summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-06-21 08:49:25 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2010-06-30 08:18:15 -0700
commit821e67a135d8773c8e9c0b97088b2e64c3d0d631 (patch)
treeae5f85c583220fd2432a5d9f162143b2d0e1d309
parent15d93ed070125d51693f102a0f94045dcaf30d9b (diff)
downloadop-kernel-dev-821e67a135d8773c8e9c0b97088b2e64c3d0d631.zip
op-kernel-dev-821e67a135d8773c8e9c0b97088b2e64c3d0d631.tar.gz
Staging: comedi: fix read past end of array in cb_pcidda_attach()
There are only 6 elements in the cb_pcidda_boards[] array so the original code read past the end. After this change nothing uses N_BOARDS so I removed the definition. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidda.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c
index 81829d6..c374bee 100644
--- a/drivers/staging/comedi/drivers/cb_pcidda.c
+++ b/drivers/staging/comedi/drivers/cb_pcidda.c
@@ -52,7 +52,6 @@ Please report success/failure with other different cards to
#include "8255.h"
#define PCI_VENDOR_ID_CB 0x1307 /* PCI vendor number of ComputerBoards */
-#define N_BOARDS 10 /* Number of boards in cb_pcidda_boards */
#define EEPROM_SIZE 128 /* number of entries in eeprom */
#define MAX_AO_CHANNELS 8 /* maximum number of ao channels for supported boards */
@@ -307,7 +306,7 @@ static int cb_pcidda_attach(struct comedi_device *dev,
continue;
}
}
- for (index = 0; index < N_BOARDS; index++) {
+ for (index = 0; index < ARRAY_SIZE(cb_pcidda_boards); index++) {
if (cb_pcidda_boards[index].device_id ==
pcidev->device) {
goto found;
OpenPOWER on IntegriCloud