cxgb4: Fix error codes in c4iw_create_cq()
[pandora-kernel.git] / drivers / infiniband / hw / cxgb4 / cq.c
index 0f1607c..3e5f576 100644 (file)
@@ -826,6 +826,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
                goto err2;
 
        if (ucontext) {
+               ret = -ENOMEM;
                mm = kmalloc(sizeof *mm, GFP_KERNEL);
                if (!mm)
                        goto err3;
@@ -843,7 +844,8 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev, int entries,
                uresp.gts_key = ucontext->key;
                ucontext->key += PAGE_SIZE;
                spin_unlock(&ucontext->mmap_lock);
-               ret = ib_copy_to_udata(udata, &uresp, sizeof uresp);
+               ret = ib_copy_to_udata(udata, &uresp,
+                                      sizeof(uresp) - sizeof(uresp.reserved));
                if (ret)
                        goto err5;