Update of /cvsroot/alsa/alsa-kernel/core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25215
Modified Files:
pcm_timer.c
Log Message:
Fix in snd_pcm_timer_resolution_change() - it no longer oops when
32-bit value overflows.
Index: pcm_timer.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/pcm_timer.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- pcm_timer.c 13 Aug 2002 16:13:34 -0000 1.6
+++ pcm_timer.c 23 Mar 2004 08:37:09 -0000 1.7
@@ -32,9 +32,9 @@
*/
/* Greatest common divisor */
-static int gcd(int a, int b)
+static unsigned long gcd(unsigned long a, unsigned long b)
{
- int r;
+ unsigned long r;
if (a < b) {
r = a;
a = b;
@@ -49,7 +49,7 @@
void snd_pcm_timer_resolution_change(snd_pcm_substream_t *substream)
{
- unsigned int rate, mult, fsize, l;
+ unsigned long rate, mult, fsize, l;
snd_pcm_runtime_t *runtime = substream->runtime;
mult = 1000000000;
@@ -67,7 +67,11 @@
mult /= 2;
rate /= 2;
}
- snd_assert(rate != 0, return);
+ if (rate == 0) {
+ snd_printk(KERN_ERR "pcm timer resolution out of range (rate = %u,
period_size = %lu)\n", runtime->rate, runtime->period_size);
+ runtime->timer_resolution = -1;
+ return;
+ }
runtime->timer_resolution = mult * fsize / rate;
}
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog