From: Takashi Iwai <tiwai@suse.de>
To: Xi Wang <xi.wang@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>,
Clemens Ladisch <clemens@ladisch.de>,
Daniel Mack <zonque@gmail.com>, Wolfgang Breyha <wbreyha@gmx.net>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: usb-audio: fix possible hang and overflow in parse_uac2_sample_rate_range()
Date: Sun, 08 Jan 2012 14:20:15 +0100 [thread overview]
Message-ID: <s5h39bqmiuo.wl%tiwai@suse.de> (raw)
In-Reply-To: <780588F2-6183-44B3-8EB8-CB82FB3DD8A7@gmail.com>
At Sun, 8 Jan 2012 07:45:09 -0500,
Xi Wang wrote:
>
> On Jan 8, 2012, at 4:09 AM, Takashi Iwai wrote:
> > As of now, I have little time to evaluate, so I might have missed
> > something, but I wonder whether
> >
> > /* avoid overflow */
> > if (nr_rates == KMALLOC_MAX_SIZE / sizeof(int))
> > break;
> >
> > is the best way to check. This looks ugly to me.
> > If we need to limit the number of rates, better to define some proper
> > numbers as the upper limit. And then, it should warn, not only
> > breaking loop.
>
> Thanks for looking into this. Yeah, I agree using something like
> MAX_NR_RATES is better. Is 65535 okay or do we need a larger limit?
It's way too higher than any realistic situation ;)
I guess 1000 or such should suffice.
thanks,
Takashi
next prev parent reply other threads:[~2012-01-08 13:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-04 17:39 [PATCH] ALSA: usb-audio: fix possible hang and overflow in parse_uac2_sample_rate_range() Xi Wang
2012-01-08 9:09 ` Takashi Iwai
2012-01-08 12:45 ` Xi Wang
2012-01-08 13:20 ` Takashi Iwai [this message]
2012-01-08 13:55 ` Xi Wang
2012-01-08 14:02 ` [PATCH v2] " Xi Wang
2012-01-08 15:04 ` 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=s5h39bqmiuo.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=clemens@ladisch.de \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=wbreyha@gmx.net \
--cc=xi.wang@gmail.com \
--cc=zonque@gmail.com \
/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