diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-12-01 13:13:49 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-12-05 10:55:13 -0800 |
commit | caec3c5776b477c4de0620787b0aed77b6846810 (patch) | |
tree | 0d9ccea64241a194cdac6fc852b61ce99f8adef7 /drivers | |
parent | 228d6b8f4ca2c057e9c63559f72af111b4356bd3 (diff) |
parport_serial: fix array overflow
commit 36be47d6d8d98f54b6c4f891e9f54fb2bf554584 upstream.
The netmos_9xx5_combo type assumes that PCI SSID provides always the
correct value for the number of parallel and serial ports, but there are
indeed broken devices with wrong numbers, which may result in Oops.
This patch simply adds the check of the array range.
Reference: Novell bnc#447067
https://bugzilla.novell.com/show_bug.cgi?id=447067
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/parport/parport_serial.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/parport/parport_serial.c b/drivers/parport/parport_serial.c index e2e95b36a603..101ed49a2d15 100644 --- a/drivers/parport/parport_serial.c +++ b/drivers/parport/parport_serial.c @@ -70,6 +70,8 @@ static int __devinit netmos_parallel_init(struct pci_dev *dev, struct parport_pc * parallel ports and <S> is the number of serial ports. */ card->numports = (dev->subsystem_device & 0xf0) >> 4; + if (card->numports > ARRAY_SIZE(card->addr)) + card->numports = ARRAY_SIZE(card->addr); return 0; } |