Merge branch 'fix' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6
[pandora-kernel.git] / drivers / infiniband / core / ucm.c
index 512b1c4..08f948d 100644 (file)
@@ -706,14 +706,9 @@ static int ib_ucm_alloc_data(const void **dest, u64 src, u32 len)
        if (!len)
                return 0;
 
-       data = kmalloc(len, GFP_KERNEL);
-       if (!data)
-               return -ENOMEM;
-
-       if (copy_from_user(data, (void __user *)(unsigned long)src, len)) {
-               kfree(data);
-               return -EFAULT;
-       }
+       data = memdup_user((void __user *)(unsigned long)src, len);
+       if (IS_ERR(data))
+               return PTR_ERR(data);
 
        *dest = data;
        return 0;
@@ -1181,7 +1176,7 @@ static int ib_ucm_open(struct inode *inode, struct file *filp)
        file->filp = filp;
        file->device = container_of(inode->i_cdev, struct ib_ucm_device, cdev);
 
-       return 0;
+       return nonseekable_open(inode, filp);
 }
 
 static int ib_ucm_close(struct inode *inode, struct file *filp)
@@ -1229,6 +1224,7 @@ static const struct file_operations ucm_fops = {
        .release = ib_ucm_close,
        .write   = ib_ucm_write,
        .poll    = ib_ucm_poll,
+       .llseek  = no_llseek,
 };
 
 static ssize_t show_ibdev(struct device *dev, struct device_attribute *attr,