android_kernel_xiaomi_sm8350/sound/firewire/fireface
Geert Uytterhoeven 68e67535e2 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:26:18 +01:00
..
amdtp-ff.c
ff-hwdep.c
ff-midi.c
ff-pcm.c
ff-proc.c
ff-protocol-former.c
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 Merge remote-tracking branch 'remotes/origin/tmp-f686d9f' into msm-lahaina 2019-07-01 17:41:24 -07:00
ff.h
Makefile