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] sound: oss/sb_audio: cap value in sb201_audio_set_speed()
Date: Sun, 18 Nov 2012 10:28:46 +0100 [thread overview]
Message-ID: <s5htxsn8dkh.wl%tiwai@suse.de> (raw)
In-Reply-To: <20121117150857.GC19951@elgon.mountain>
At Sat, 17 Nov 2012 18:08:57 +0300,
Dan Carpenter wrote:
>
> We set "s" before we have capped "speed" so it could be the wrong value.
> This could lead to a divide by zero bug.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I fixed a similar bug in this file in Aug. I'm not sure how I missed
> this one. I don't see any others I missed.
Thanks, applied.
Takashi
>
> diff --git a/sound/oss/sb_audio.c b/sound/oss/sb_audio.c
> index b2b3c01..048439a 100644
> --- a/sound/oss/sb_audio.c
> +++ b/sound/oss/sb_audio.c
> @@ -442,7 +442,7 @@ static int sb201_audio_set_speed(int dev, int speed)
> {
> sb_devc *devc = audio_devs[dev]->devc;
> int tmp;
> - int s = speed * devc->channels;
> + int s;
>
> if (speed > 0)
> {
> @@ -452,6 +452,7 @@ static int sb201_audio_set_speed(int dev, int speed)
> speed = 44100;
> if (devc->opened & OPEN_READ && speed > 15000)
> speed = 15000;
> + s = speed * devc->channels;
> devc->tconst = (256 - ((1000000 + s / 2) / s)) & 0xff;
> tmp = 256 - devc->tconst;
> speed = ((1000000 + tmp / 2) / tmp) / devc->channels;
>
WARNING: multiple messages have this Message-ID (diff)
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] sound: oss/sb_audio: cap value in sb201_audio_set_speed()
Date: Sun, 18 Nov 2012 09:28:46 +0000 [thread overview]
Message-ID: <s5htxsn8dkh.wl%tiwai@suse.de> (raw)
In-Reply-To: <20121117150857.GC19951@elgon.mountain>
At Sat, 17 Nov 2012 18:08:57 +0300,
Dan Carpenter wrote:
>
> We set "s" before we have capped "speed" so it could be the wrong value.
> This could lead to a divide by zero bug.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I fixed a similar bug in this file in Aug. I'm not sure how I missed
> this one. I don't see any others I missed.
Thanks, applied.
Takashi
>
> diff --git a/sound/oss/sb_audio.c b/sound/oss/sb_audio.c
> index b2b3c01..048439a 100644
> --- a/sound/oss/sb_audio.c
> +++ b/sound/oss/sb_audio.c
> @@ -442,7 +442,7 @@ static int sb201_audio_set_speed(int dev, int speed)
> {
> sb_devc *devc = audio_devs[dev]->devc;
> int tmp;
> - int s = speed * devc->channels;
> + int s;
>
> if (speed > 0)
> {
> @@ -452,6 +452,7 @@ static int sb201_audio_set_speed(int dev, int speed)
> speed = 44100;
> if (devc->opened & OPEN_READ && speed > 15000)
> speed = 15000;
> + s = speed * devc->channels;
> devc->tconst = (256 - ((1000000 + s / 2) / s)) & 0xff;
> tmp = 256 - devc->tconst;
> speed = ((1000000 + tmp / 2) / tmp) / devc->channels;
>
next prev parent reply other threads:[~2012-11-18 9:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-17 15:08 [patch] sound: oss/sb_audio: cap value in sb201_audio_set_speed() Dan Carpenter
2012-11-17 15:08 ` Dan Carpenter
2012-11-18 9:28 ` Takashi Iwai [this message]
2012-11-18 9:28 ` Takashi Iwai
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=s5htxsn8dkh.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.