android_kernel_xiaomi_sm7250/sound/firewire/fireface
Geert Uytterhoeven f1bf14dab4 ALSA: fireface: Fix integer overflow in transmit_midi_msg()
commit e7c22eeaff8565d9a8374f320238c251ca31480b 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:22:38 +01:00
..
amdtp-ff.c locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE() 2017-10-25 11:01:08 +02:00
ff-hwdep.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
ff-midi.c locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE() 2017-10-25 11:01:08 +02:00
ff-pcm.c ALSA: pcm: Nuke snd_pcm_lib_mmap_vmalloc() 2018-07-18 08:24:29 +02:00
ff-proc.c sound: Use octal not symbolic permissions 2018-05-28 11:27:20 +02:00
ff-protocol-ff400.c ALSA: fireface: fix for state to fetch PCM frames 2019-01-09 17:38:37 +01:00
ff-stream.c ALSA: fireface: add hwdep interface 2017-04-05 21:31:49 +02:00
ff-transaction.c ALSA: fireface: Fix integer overflow in transmit_midi_msg() 2021-01-19 18:22:38 +01:00
ff.c ALSA: firewire: add const qualifier to identifiers for read-only symbols 2017-08-22 16:08:00 +02:00
ff.h ALSA: firewire: add const qualifier to identifiers for read-only symbols 2017-08-22 16:08:00 +02:00
Makefile ALSA: fireface: add support for Fireface 400 2017-04-05 21:31:54 +02:00