Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org
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	[thread overview]
Message-ID: <s5h7eb368k1.wl-tiwai@suse.de> (raw)
In-Reply-To: <20190506125119.GB13799@mwanda>

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 <dan.carpenter@oracle.com>

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
> 
> 

      reply	other threads:[~2019-05-06 13:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-06 12:51 [PATCH] ALSA: synth: emux: soundfont.c: divide by zero in calc_gus_envelope_time() Dan Carpenter
2019-05-06 13:01 ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5h7eb368k1.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox