diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-10-22 11:20:10 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-23 02:07:55 -0400 |
commit | 41923e441305728ba3640e773e55d16e4769145c (patch) | |
tree | eeaad57d30237f5f26851f8f72a24485177ba077 /sound/pci | |
parent | 7507e8da2f21476007501f04d8bce2b7d0cb3971 (diff) |
[ALSA] hda-codec - Fix possible array overflow
dac_nids arrays in each codec support code may have up to 5 items
when assigned from the auto-configurator. Some codec codes have
less numbers than the possible max. This patch defines the constant
and fixes the array definitions.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_local.h | 11 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_cmedia.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 2 |
6 files changed, 11 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index a708effdcdad..20c5e6250374 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -310,16 +310,17 @@ enum { | |||
310 | 310 | ||
311 | extern const char *auto_pin_cfg_labels[AUTO_PIN_LAST]; | 311 | extern const char *auto_pin_cfg_labels[AUTO_PIN_LAST]; |
312 | 312 | ||
313 | #define AUTO_CFG_MAX_OUTS 5 | ||
314 | |||
313 | struct auto_pin_cfg { | 315 | struct auto_pin_cfg { |
314 | int line_outs; | 316 | int line_outs; |
315 | hda_nid_t line_out_pins[5]; /* sorted in the order of | 317 | /* sorted in the order of Front/Surr/CLFE/Side */ |
316 | * Front/Surr/CLFE/Side | 318 | hda_nid_t line_out_pins[AUTO_CFG_MAX_OUTS]; |
317 | */ | ||
318 | int speaker_outs; | 319 | int speaker_outs; |
319 | hda_nid_t speaker_pins[5]; | 320 | hda_nid_t speaker_pins[AUTO_CFG_MAX_OUTS]; |
320 | int hp_outs; | 321 | int hp_outs; |
321 | int line_out_type; /* AUTO_PIN_XXX_OUT */ | 322 | int line_out_type; /* AUTO_PIN_XXX_OUT */ |
322 | hda_nid_t hp_pins[5]; | 323 | hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS]; |
323 | hda_nid_t input_pins[AUTO_PIN_LAST]; | 324 | hda_nid_t input_pins[AUTO_PIN_LAST]; |
324 | hda_nid_t dig_out_pin; | 325 | hda_nid_t dig_out_pin; |
325 | hda_nid_t dig_in_pin; | 326 | hda_nid_t dig_in_pin; |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index 9bf38f92ba74..0ee8ae4d4410 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -72,7 +72,7 @@ struct ad198x_spec { | |||
72 | unsigned int num_kctl_alloc, num_kctl_used; | 72 | unsigned int num_kctl_alloc, num_kctl_used; |
73 | struct snd_kcontrol_new *kctl_alloc; | 73 | struct snd_kcontrol_new *kctl_alloc; |
74 | struct hda_input_mux private_imux; | 74 | struct hda_input_mux private_imux; |
75 | hda_nid_t private_dac_nids[4]; | 75 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
76 | 76 | ||
77 | unsigned int jack_present :1; | 77 | unsigned int jack_present :1; |
78 | 78 | ||
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index 2468f3171222..6c54793bf424 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -50,7 +50,7 @@ struct cmi_spec { | |||
50 | 50 | ||
51 | /* playback */ | 51 | /* playback */ |
52 | struct hda_multi_out multiout; | 52 | struct hda_multi_out multiout; |
53 | hda_nid_t dac_nids[4]; /* NID for each DAC */ | 53 | hda_nid_t dac_nids[AUTO_CFG_MAX_OUTS]; /* NID for each DAC */ |
54 | int num_dacs; | 54 | int num_dacs; |
55 | 55 | ||
56 | /* capture */ | 56 | /* capture */ |
@@ -73,7 +73,6 @@ struct cmi_spec { | |||
73 | unsigned int pin_def_confs; | 73 | unsigned int pin_def_confs; |
74 | 74 | ||
75 | /* multichannel pins */ | 75 | /* multichannel pins */ |
76 | hda_nid_t multich_pin[4]; /* max 8-channel */ | ||
77 | struct hda_verb multi_init[9]; /* 2 verbs for each pin + terminator */ | 76 | struct hda_verb multi_init[9]; /* 2 verbs for each pin + terminator */ |
78 | }; | 77 | }; |
79 | 78 | ||
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 7df9058b234c..6aa073986747 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -85,7 +85,7 @@ struct conexant_spec { | |||
85 | unsigned int num_kctl_alloc, num_kctl_used; | 85 | unsigned int num_kctl_alloc, num_kctl_used; |
86 | struct snd_kcontrol_new *kctl_alloc; | 86 | struct snd_kcontrol_new *kctl_alloc; |
87 | struct hda_input_mux private_imux; | 87 | struct hda_input_mux private_imux; |
88 | hda_nid_t private_dac_nids[4]; | 88 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
89 | 89 | ||
90 | }; | 90 | }; |
91 | 91 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 53b0428abfc2..d9f78c809ee9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -238,7 +238,7 @@ struct alc_spec { | |||
238 | unsigned int num_kctl_alloc, num_kctl_used; | 238 | unsigned int num_kctl_alloc, num_kctl_used; |
239 | struct snd_kcontrol_new *kctl_alloc; | 239 | struct snd_kcontrol_new *kctl_alloc; |
240 | struct hda_input_mux private_imux; | 240 | struct hda_input_mux private_imux; |
241 | hda_nid_t private_dac_nids[5]; | 241 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
242 | 242 | ||
243 | /* hooks */ | 243 | /* hooks */ |
244 | void (*init_hook)(struct hda_codec *codec); | 244 | void (*init_hook)(struct hda_codec *codec); |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 33b5e1ffa817..4cdf3e6df4ba 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -114,7 +114,7 @@ struct via_spec { | |||
114 | unsigned int num_kctl_alloc, num_kctl_used; | 114 | unsigned int num_kctl_alloc, num_kctl_used; |
115 | struct snd_kcontrol_new *kctl_alloc; | 115 | struct snd_kcontrol_new *kctl_alloc; |
116 | struct hda_input_mux private_imux; | 116 | struct hda_input_mux private_imux; |
117 | hda_nid_t private_dac_nids[4]; | 117 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
118 | 118 | ||
119 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 119 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
120 | struct hda_loopback_check loopback; | 120 | struct hda_loopback_check loopback; |