linux/sound/firewire/fireface
Geert Uytterhoeven e7c22eeaff ALSA: fireface: Fix integer overflow in transmit_midi_msg()
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>
2021-01-12 14:57:29 +01: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: firewire: Drop superfluous ioctl PCM ops 2019-12-11 07:25: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: add support for RME Fireface UFX (untested) 2020-05-10 12:03:50 +02:00
ff-stream.c ALSA: fireface: start IR context immediately 2020-05-10 12:03:47 +02:00
ff-transaction.c ALSA: fireface: Fix integer overflow in transmit_midi_msg() 2021-01-12 14:57:29 +01:00
ff.c ALSA: fireface: add support for RME Fireface UFX (untested) 2020-05-10 12:03:50 +02:00
ff.h ALSA: fireface: add support for RME Fireface UFX (untested) 2020-05-10 12:03:50 +02:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00