Update of /cvsroot/alsa/alsa-kernel/core
In directory usw-pr-cvs1:/tmp/cvs-serv1394

Modified Files:
        pcm_native.c 
Log Message:
Reduced stack usage in ioctl() functions

Index: pcm_native.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/core/pcm_native.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- pcm_native.c        12 Oct 2002 11:49:01 -0000      1.30
+++ pcm_native.c        12 Oct 2002 15:37:15 -0000      1.31
@@ -2114,7 +2114,7 @@
        {
                snd_xfern_t xfern, *_xfern = arg;
                snd_pcm_runtime_t *runtime = substream->runtime;
-               void *bufs[128];
+               void *bufs;
                snd_pcm_sframes_t result;
                if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
                        return -EBADFD;
@@ -2124,9 +2124,15 @@
                        return -EFAULT;
                if (copy_from_user(&xfern, _xfern, sizeof(xfern)))
                        return -EFAULT;
-               if (copy_from_user(bufs, xfern.bufs, sizeof(*bufs) * 
runtime->channels))
+               bufs = kmalloc(sizeof(void *) * 128, GFP_KERNEL);
+               if (bufs == NULL)
+                       return -ENOMEM;
+               if (copy_from_user(bufs, xfern.bufs, sizeof(*bufs) * 
+runtime->channels)) {
+                       kfree(bufs);
                        return -EFAULT;
+               }
                result = snd_pcm_lib_writev(substream, bufs, xfern.frames);
+               kfree(bufs);
                __put_user(result, &_xfern->result);
                return result < 0 ? result : 0;
        }
@@ -2183,7 +2189,7 @@
        {
                snd_xfern_t xfern, *_xfern = arg;
                snd_pcm_runtime_t *runtime = substream->runtime;
-               void *bufs[128];
+               void *bufs;
                snd_pcm_sframes_t result;
                if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
                        return -EBADFD;
@@ -2193,9 +2199,15 @@
                        return -EFAULT;
                if (copy_from_user(&xfern, _xfern, sizeof(xfern)))
                        return -EFAULT;
-               if (copy_from_user(bufs, xfern.bufs, sizeof(*bufs) * 
runtime->channels))
+               bufs = kmalloc(sizeof(void *) * 128, GFP_KERNEL);
+               if (bufs == NULL)
+                       return -ENOMEM;
+               if (copy_from_user(bufs, xfern.bufs, sizeof(*bufs) * 
+runtime->channels)) {
+                       kfree(bufs);
                        return -EFAULT;
+               }
                result = snd_pcm_lib_readv(substream, bufs, xfern.frames);
+               kfree(bufs);
                __put_user(result, &_xfern->result);
                return result < 0 ? result : 0;
        }



-------------------------------------------------------
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

Reply via email to