Skip to content

Commit

Permalink
ALSA: dice: fix array limits in dice_proc_read()
Browse files Browse the repository at this point in the history
The array limits are supposed to be in units of u32 instead of in bytes.
The current code has a potential array overflow.

Fixes: c614475 ('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>
  • Loading branch information
Dan Carpenter authored and Takashi Iwai committed Nov 29, 2013
1 parent eb82594 commit 4d6ff25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sound/firewire/dice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ static void dice_proc_read(struct snd_info_entry *entry,

if (dice_proc_read_mem(dice, &tx_rx_header, sections[2], 2) < 0)
return;
quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.tx));
quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.tx) / 4);
for (stream = 0; stream < tx_rx_header.number; ++stream) {
if (dice_proc_read_mem(dice, &buf.tx, sections[2] + 2 +
stream * tx_rx_header.size,
Expand All @@ -1045,7 +1045,7 @@ static void dice_proc_read(struct snd_info_entry *entry,

if (dice_proc_read_mem(dice, &tx_rx_header, sections[4], 2) < 0)
return;
quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.rx));
quadlets = min_t(u32, tx_rx_header.size, sizeof(buf.rx) / 4);
for (stream = 0; stream < tx_rx_header.number; ++stream) {
if (dice_proc_read_mem(dice, &buf.rx, sections[4] + 2 +
stream * tx_rx_header.size,
Expand Down

0 comments on commit 4d6ff25

Please sign in to comment.