MIPS: 64-bit: Fix system lockup.
[safe/jmp/linux-2.6] / sound / core / pcm_compat.c
index 49aa693..08bfed5 100644 (file)
@@ -232,14 +232,11 @@ static int snd_pcm_ioctl_hw_params_compat(struct snd_pcm_substream *substream,
        if (! (runtime = substream->runtime))
                return -ENOTTY;
 
-       data = kmalloc(sizeof(*data), GFP_KERNEL);
-       if (data == NULL)
-               return -ENOMEM;
        /* only fifo_size is different, so just copy all */
-       if (copy_from_user(data, data32, sizeof(*data32))) {
-               err = -EFAULT;
-               goto error;
-       }
+       data = memdup_user(data32, sizeof(*data32));
+       if (IS_ERR(data))
+               return PTR_ERR(data);
+
        if (refine)
                err = snd_pcm_hw_refine(substream, data);
        else
@@ -397,7 +394,8 @@ static int snd_pcm_ioctl_sync_ptr_compat(struct snd_pcm_substream *substream,
        snd_pcm_uframes_t boundary;
        int err;
 
-       snd_assert(runtime, return -EINVAL);
+       if (snd_BUG_ON(!runtime))
+               return -EINVAL;
 
        if (get_user(sflags, &src->flags) ||
            get_user(scontrol.appl_ptr, &src->c.control.appl_ptr) ||