summaryrefslogtreecommitdiffstats
path: root/sound/synth
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2019-05-06 14:51:19 +0200
committerTakashi Iwai <tiwai@suse.de>2019-05-06 15:08:08 +0200
commit2854cd34fbab5f28a356d3667c26b7856a7b73e2 (patch)
tree3b195fc5c6918e3f621973a8dce8a74aa9bf5066 /sound/synth
parentMerge branch 'for-linus' into for-next (diff)
downloadlinux-2854cd34fbab5f28a356d3667c26b7856a7b73e2.tar.xz
linux-2854cd34fbab5f28a356d3667c26b7856a7b73e2.zip
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 <dan.carpenter@oracle.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/synth')
-rw-r--r--sound/synth/emux/soundfont.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c
index 31a4ea94830e..9b5d70104489 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)