Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zubin Mithra <zsm@chromium.org>
To: Takashi Iwai <tiwai@suse.de>
Cc: groeck@chromium.org, alsa-devel@alsa-project.org, tiwai@suse.com
Subject: Re: [PATCH] ALSA: pcm: fix divide error in snd_pcm_lib_ioctl
Date: Fri, 27 Aug 2021 08:39:48 -0700	[thread overview]
Message-ID: <YSkHRKoP0s9REufk@google.com> (raw)
In-Reply-To: <s5hk0k7toc3.wl-tiwai@suse.de>

On Fri, Aug 27, 2021 at 08:05:00AM +0200, Takashi Iwai wrote:
> On Fri, 27 Aug 2021 02:48:21 +0200,
> Zubin Mithra wrote:
> > 
> > Syzkaller reported a divide error in snd_pcm_lib_ioctl. fifo_size
> > is of type snd_pcm_uframes_t(unsigned long). If frame_size
> > is 0x100000000, the error occurs.
> > 
> > Fixes: a9960e6a293e ("ALSA: pcm: fix fifo_size frame calculation")
> > Signed-off-by: Zubin Mithra <zsm@chromium.org>
> > ---
> >  sound/core/pcm_lib.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
> > index 7d5883432085..e41b4e01aa37 100644
> > --- a/sound/core/pcm_lib.c
> > +++ b/sound/core/pcm_lib.c
> > @@ -1746,7 +1746,7 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream,
> >  		channels = params_channels(params);
> >  		frame_size = snd_pcm_format_size(format, channels);
> >  		if (frame_size > 0)
> > -			params->fifo_size /= (unsigned)frame_size;
> > +			params->fifo_size /= (unsigned long)frame_size;
> 
> I guess we can drop the cast completely, instead?
> It'd be less ugliness.

Sounds good, thanks, I've sent out a v2.

> 
> 
> Thanks!
> 
> Takashi

      reply	other threads:[~2021-08-27 15:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-27  0:48 [PATCH] ALSA: pcm: fix divide error in snd_pcm_lib_ioctl Zubin Mithra
2021-08-27  6:05 ` Takashi Iwai
2021-08-27 15:39   ` Zubin Mithra [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=YSkHRKoP0s9REufk@google.com \
    --to=zsm@chromium.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=groeck@chromium.org \
    --cc=tiwai@suse.com \
    --cc=tiwai@suse.de \
    /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