vserver 2.0 rc7
[linux-2.6.git] / sound / core / seq / seq_memory.c
index 298cfd3..00d841e 100644 (file)
@@ -90,12 +90,12 @@ int snd_seq_dump_var_event(const snd_seq_event_t *event, snd_seq_dump_func_t fun
 
        if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
                char buf[32];
-               char *curptr = event->data.ext.ptr;
+               char __user *curptr = (char __user *)event->data.ext.ptr;
                while (len > 0) {
                        int size = sizeof(buf);
                        if (len < size)
                                size = len;
-                       if (copy_from_user(buf, curptr, size) < 0)
+                       if (copy_from_user(buf, curptr, size))
                                return -EFAULT;
                        err = func(private_data, buf, size);
                        if (err < 0)
@@ -134,7 +134,7 @@ static int seq_copy_in_kernel(char **bufptr, const void *src, int size)
        return 0;
 }
 
-static int seq_copy_in_user(char **bufptr, const void *src, int size)
+static int seq_copy_in_user(char __user **bufptr, const void *src, int size)
 {
        if (copy_to_user(*bufptr, src, size))
                return -EFAULT;
@@ -158,7 +158,7 @@ int snd_seq_expand_var_event(const snd_seq_event_t *event, int count, char *buf,
        if (event->data.ext.len & SNDRV_SEQ_EXT_USRPTR) {
                if (! in_kernel)
                        return -EINVAL;
-               if (copy_from_user(buf, event->data.ext.ptr, len) < 0)
+               if (copy_from_user(buf, (void __user *)event->data.ext.ptr, len))
                        return -EFAULT;
                return newlen;
        }
@@ -215,7 +215,7 @@ void snd_seq_cell_free(snd_seq_event_cell_t * cell)
 /*
  * allocate an event cell.
  */
-int snd_seq_cell_alloc(pool_t *pool, snd_seq_event_cell_t **cellp, int nonblock, struct file *file)
+static int snd_seq_cell_alloc(pool_t *pool, snd_seq_event_cell_t **cellp, int nonblock, struct file *file)
 {
        snd_seq_event_cell_t *cell;
        unsigned long flags;
@@ -336,7 +336,7 @@ int snd_seq_event_dup(pool_t *pool, snd_seq_event_t *event, snd_seq_event_cell_t
                                tmp->event = src->event;
                                src = src->next;
                        } else if (is_usrptr) {
-                               if (copy_from_user(&tmp->event, buf, size)) {
+                               if (copy_from_user(&tmp->event, (char __user *)buf, size)) {
                                        err = -EFAULT;
                                        goto __error;
                                }
@@ -436,8 +436,7 @@ int snd_seq_pool_done(pool_t *pool)
        pool->total_elements = 0;
        spin_unlock_irqrestore(&pool->lock, flags);
 
-       if (ptr)
-               vfree(ptr);
+       vfree(ptr);
 
        spin_lock_irqsave(&pool->lock, flags);
        pool->closing = 0;
@@ -453,7 +452,7 @@ pool_t *snd_seq_pool_new(int poolsize)
        pool_t *pool;
 
        /* create pool block */
-       pool = snd_kcalloc(sizeof(pool_t), GFP_KERNEL);
+       pool = kcalloc(1, sizeof(*pool), GFP_KERNEL);
        if (pool == NULL) {
                snd_printd("seq: malloc failed for pool\n");
                return NULL;