diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-12-01 16:13:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-12-01 22:55:24 -0500 |
commit | 36be47d6d8d98f54b6c4f891e9f54fb2bf554584 (patch) | |
tree | a9f9e9c5fb1ac2dffe7dc248a823ce5586a5ef09 /drivers | |
parent | dc19f9db38295f811d9041bd89b113beccbd763a (diff) |
parport_serial: fix array overflow
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>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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 | |||
70 | * parallel ports and <S> is the number of serial ports. | 70 | * parallel ports and <S> is the number of serial ports. |
71 | */ | 71 | */ |
72 | card->numports = (dev->subsystem_device & 0xf0) >> 4; | 72 | card->numports = (dev->subsystem_device & 0xf0) >> 4; |
73 | if (card->numports > ARRAY_SIZE(card->addr)) | ||
74 | card->numports = ARRAY_SIZE(card->addr); | ||
73 | return 0; | 75 | return 0; |
74 | } | 76 | } |
75 | 77 | ||