aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2013-11-29 03:14:09 -0500
committerTakashi Iwai <tiwai@suse.de>2013-11-29 04:23:04 -0500
commit4d6ff250857a8b5f8e33ea62ff16f165085f8655 (patch)
treed9302124d8aed364304691841a93ec156e563295 /sound
parenteb82594b75b0cf54c667189e061934b7c49b5d42 (diff)
ALSA: dice: fix array limits in dice_proc_read()
The array limits are supposed to be in units of u32 instead of in bytes. The current code has a potential array overflow. Fixes: c614475b0ea9 ('ALSA: dice: add a proc file to show device information') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/firewire/dice.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/firewire/dice.c b/sound/firewire/dice.c
index 57bcd31fcc12..c0aa64941cee 100644
--- a/sound/firewire/dice.c
+++ b/sound/firewire/dice.c
@@ -1019,7 +1019,7 @@ static void dice_proc_read(struct snd_info_entry *entry,
1019 1019
1020 if (dice_proc_read_mem(dice, &tx_rx_header, sections[2], 2) < 0) 1020 if (dice_proc_read_mem(dice, &tx_rx_header, sections[2], 2) < 0)
1021 return; 1021 return;
1022 quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.tx)); 1022 quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.tx) / 4);
1023 for (stream = 0; stream < tx_rx_header.number; ++stream) { 1023 for (stream = 0; stream < tx_rx_header.number; ++stream) {
1024 if (dice_proc_read_mem(dice, &buf.tx, sections[2] + 2 + 1024 if (dice_proc_read_mem(dice, &buf.tx, sections[2] + 2 +
1025 stream * tx_rx_header.size, 1025 stream * tx_rx_header.size,
@@ -1045,7 +1045,7 @@ static void dice_proc_read(struct snd_info_entry *entry,
1045 1045
1046 if (dice_proc_read_mem(dice, &tx_rx_header, sections[4], 2) < 0) 1046 if (dice_proc_read_mem(dice, &tx_rx_header, sections[4], 2) < 0)
1047 return; 1047 return;
1048 quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.rx)); 1048 quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.rx) / 4);
1049 for (stream = 0; stream < tx_rx_header.number; ++stream) { 1049 for (stream = 0; stream < tx_rx_header.number; ++stream) {
1050 if (dice_proc_read_mem(dice, &buf.rx, sections[4] + 2 + 1050 if (dice_proc_read_mem(dice, &buf.rx, sections[4] + 2 +
1051 stream * tx_rx_header.size, 1051 stream * tx_rx_header.size,