From: Dan Carpenter Date: Mon, 6 May 2019 12:51:19 +0000 (+0300) Subject: ALSA: synth: emux: soundfont.c: divide by zero in calc_gus_envelope_time() X-Git-Tag: v5.15~6314^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2854cd34fbab5f28a356d3667c26b7856a7b73e2;p=platform%2Fkernel%2Flinux-starfive.git ALSA: synth: emux: soundfont.c: divide by zero in calc_gus_envelope_time() This function is called from load_guspatch() and the rate is specified by the user. If they accidentally selected zero then it would crash the kernel. I've just changed the zero to a one. Signed-off-by: Dan Carpenter Signed-off-by: Takashi Iwai --- diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c index 31a4ea9..9b5d701 100644 --- a/sound/synth/emux/soundfont.c +++ b/sound/synth/emux/soundfont.c @@ -856,6 +856,8 @@ calc_gus_envelope_time(int rate, int start, int end) int r, p, t; r = (3 - ((rate >> 6) & 3)) * 3; p = rate & 0x3f; + if (!p) + p = 1; t = end - start; if (t < 0) t = -t; if (13 > r)