Skip to content

Commit

Permalink
Staging: comedi: fix read past end of array in cb_pcidda_attach()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Jun 30, 2010
1 parent 15d93ed commit 821e67a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/comedi/drivers/cb_pcidda.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 821e67a

Please sign in to comment.