From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] ALSA: synth: emux: soundfont.c: divide by zero in calc_gus_envelope_time() Date: Mon, 06 May 2019 15:01:34 +0200 Message-ID: References: <20190506125119.GB13799@mwanda> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 062EFF80726 for ; Mon, 6 May 2019 15:01:35 +0200 (CEST) In-Reply-To: <20190506125119.GB13799@mwanda> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: Dan Carpenter Cc: alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org List-Id: alsa-devel@alsa-project.org On Mon, 06 May 2019 14:51:19 +0200, Dan Carpenter wrote: > > 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 Thanks, applied now. Takashi > --- > sound/synth/emux/soundfont.c | 2 ++ > 1 file changed, 2 insertions(+) > > 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) > -- > 2.18.0 > >