diff options
| author | Asim Kadav <kadav@cs.wisc.edu> | 2013-01-03 12:47:26 -0500 |
|---|---|---|
| committer | Takashi Iwai <tiwai@suse.de> | 2013-01-04 04:38:27 -0500 |
| commit | dc30a436903ccf180b0313d3fc3f44278a1d44c8 (patch) | |
| tree | b262bd64e751b7d68a012cf0c9329845518327df | |
| parent | b7b435e81b7228af68b5d3bef277fce10100b369 (diff) | |
sound: oss/pas2: Fix possible access out of array
Added a fix for hardware dependence bug where a sound card failure
should not result in reading beyond array memory index.
Signed-off-by: Asim Kadav <kadav@cs.wisc.edu>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
| -rw-r--r-- | sound/oss/pas2_card.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/oss/pas2_card.c b/sound/oss/pas2_card.c index dabf8a871dcc..7004e24d209f 100644 --- a/sound/oss/pas2_card.c +++ b/sound/oss/pas2_card.c | |||
| @@ -333,6 +333,11 @@ static void __init attach_pas_card(struct address_info *hw_config) | |||
| 333 | { | 333 | { |
| 334 | char temp[100]; | 334 | char temp[100]; |
| 335 | 335 | ||
| 336 | if (pas_model < 0 || | ||
| 337 | pas_model >= ARRAY_SIZE(pas_model_names)) { | ||
| 338 | printk(KERN_ERR "pas2 unrecognized model.\n"); | ||
| 339 | return; | ||
| 340 | } | ||
| 336 | sprintf(temp, | 341 | sprintf(temp, |
| 337 | "%s rev %d", pas_model_names[(int) pas_model], | 342 | "%s rev %d", pas_model_names[(int) pas_model], |
| 338 | pas_read(0x2789)); | 343 | pas_read(0x2789)); |
