1
0
Fork 0
alistair23-linux/sound/firewire/fireface
Geert Uytterhoeven 68e67535e2 ALSA: fireface: Fix integer overflow in transmit_midi_msg()
commit e7c22eeaff upstream.

As snd_ff.rx_bytes[] is unsigned int, and NSEC_PER_SEC is 1000000000L,
the second multiplication in

    ff->rx_bytes[port] * 8 * NSEC_PER_SEC / 31250

always overflows on 32-bit platforms, truncating the result.  Fix this
by precalculating "NSEC_PER_SEC / 31250", which is an integer constant.

Note that this assumes ff->rx_bytes[port] <= 16777.

Fixes: 1917429578 ("ALSA: fireface: add transaction support")
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20210111130251.361335-2-geert+renesas@glider.be
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-19 18:26:18 +01:00
..
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
amdtp-ff.c ALSA: firewire-lib: process payload of isoc context according to packet descriptors 2019-07-22 16:05:11 +02:00
ff-hwdep.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 345 2019-06-05 17:37:08 +02:00
ff-midi.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 345 2019-06-05 17:37:08 +02:00
ff-pcm.c ALSA: fireface: fix return value in error path of isochronous resources reservation 2019-12-17 19:56:27 +01:00
ff-proc.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 345 2019-06-05 17:37:08 +02:00
ff-protocol-former.c ALSA: fireface: update isochronous resources when starting packet streaming after bus-reset 2019-06-11 11:36:25 +02:00
ff-protocol-latter.c ALSA: fireface: fix configuration error for nominal sampling transfer frequency 2020-06-17 16:40:27 +02:00
ff-stream.c ALSA: fireface: support AMDTP domain 2019-08-05 19:57:28 +02:00
ff-transaction.c ALSA: fireface: Fix integer overflow in transmit_midi_msg() 2021-01-19 18:26:18 +01:00
ff.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 345 2019-06-05 17:37:08 +02:00
ff.h ALSA: fireface: support AMDTP domain 2019-08-05 19:57:28 +02:00