Update of /cvsroot/alsa/alsa-kernel/core
In directory usw-pr-cvs1:/tmp/cvs-serv18894
Modified Files:
pcm_lib.c
Log Message:
Fixed stack usage in snd_pcm_hw_param_near() function
Index: pcm_lib.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/pcm_lib.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- pcm_lib.c 9 Oct 2002 20:22:41 -0000 1.19
+++ pcm_lib.c 12 Oct 2002 14:38:42 -0000 1.20
@@ -1473,7 +1473,7 @@
int snd_pcm_hw_param_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, unsigned int best, int *dir)
{
- snd_pcm_hw_params_t save;
+ snd_pcm_hw_params_t *save = NULL;
int v;
unsigned int saved_min;
int last = 0;
@@ -1493,30 +1493,42 @@
maxdir = 1;
max--;
}
- save = *params;
+ save = kmalloc(sizeof(*save), GFP_KERNEL);
+ if (save == NULL)
+ return -ENOMEM;
+ *save = *params;
saved_min = min;
min = snd_pcm_hw_param_min(pcm, params, var, min, &mindir);
if (min >= 0) {
- snd_pcm_hw_params_t params1;
+ snd_pcm_hw_params_t *params1;
if (max < 0)
goto _end;
if ((unsigned int)min == saved_min && mindir == valdir)
goto _end;
- params1 = save;
- max = snd_pcm_hw_param_max(pcm, ¶ms1, var, max, &maxdir);
- if (max < 0)
+ params1 = kmalloc(sizeof(*params1), GFP_KERNEL);
+ if (params1 == NULL) {
+ kfree(save);
+ return -ENOMEM;
+ }
+ *params1 = *save;
+ max = snd_pcm_hw_param_max(pcm, params1, var, max, &maxdir);
+ if (max < 0) {
+ kfree(params1);
goto _end;
+ }
if (boundary_nearer(max, maxdir, best, valdir, min, mindir)) {
- *params = params1;
+ *params = *params1;
last = 1;
}
+ kfree(params1);
} else {
- *params = save;
+ *params = *save;
max = snd_pcm_hw_param_max(pcm, params, var, max, &maxdir);
assert(max >= 0);
last = 1;
}
_end:
+ kfree(save);
if (last)
v = snd_pcm_hw_param_last(pcm, params, var, dir);
else
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog