aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-05-30 23:24:45 +0200
committerTakashi Iwai <tiwai@suse.de>2017-05-31 08:46:19 +0200
commite49a14fa36aeb72476e038fcde96c151b7e4ecc8 (patch)
treec4457b641b8a8b6fcc70ed679c1a20c8aa544cb7 /sound
parent617163fc2580da3d489b6c1bacb6312e0e2aac02 (diff)
ALSA: usb: Avoid VLA in mixer_us16x08.c
This is another attempt to work around the VLA used in mixer_us16x08.c. Basically the temporary array is used individually for two cases, and we can declare locally in each block, instead of hackish max() usage. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/usb/mixer_us16x08.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/usb/mixer_us16x08.c b/sound/usb/mixer_us16x08.c
index 442d8f7998e3..26ed23b18b77 100644
--- a/sound/usb/mixer_us16x08.c
+++ b/sound/usb/mixer_us16x08.c
@@ -698,16 +698,18 @@ static int snd_us16x08_meter_get(struct snd_kcontrol *kcontrol,
struct snd_usb_audio *chip = elem->head.mixer->chip;
struct snd_us16x08_meter_store *store = elem->private_data;
u8 meter_urb[64];
- char tmp[max(sizeof(mix_init_msg1), sizeof(mix_init_msg2))];
switch (kcontrol->private_value) {
- case 0:
+ case 0: {
+ char tmp[sizeof(mix_init_msg1)];
+
memcpy(tmp, mix_init_msg1, sizeof(mix_init_msg1));
snd_us16x08_send_urb(chip, tmp, 4);
snd_us16x08_recv_urb(chip, meter_urb,
sizeof(meter_urb));
kcontrol->private_value++;
break;
+ }
case 1:
snd_us16x08_recv_urb(chip, meter_urb,
sizeof(meter_urb));
@@ -718,7 +720,9 @@ static int snd_us16x08_meter_get(struct snd_kcontrol *kcontrol,
sizeof(meter_urb));
kcontrol->private_value++;
break;
- case 3:
+ case 3: {
+ char tmp[sizeof(mix_init_msg2)];
+
memcpy(tmp, mix_init_msg2, sizeof(mix_init_msg2));
tmp[2] = snd_get_meter_comp_index(store);
snd_us16x08_send_urb(chip, tmp, 10);
@@ -727,6 +731,7 @@ static int snd_us16x08_meter_get(struct snd_kcontrol *kcontrol,
kcontrol->private_value = 0;
break;
}
+ }
for (set = 0; set < 6; set++)
get_meter_levels_from_urb(set, store, meter_urb);

Privacy Policy