OSDN Git Service

RDMA/cxgb4: Use structs to describe the uABI instead of opencoding
authorJason Gunthorpe <jgg@mellanox.com>
Wed, 14 Mar 2018 22:01:50 +0000 (16:01 -0600)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 15 Mar 2018 21:58:04 +0000 (15:58 -0600)
Open coding a loose value is not acceptable for describing the uABI in
RDMA. Provide the missing struct.

Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/cxgb4/provider.c
include/uapi/rdma/cxgb4-abi.h

index 1b5c6cd..42568a4 100644 (file)
@@ -281,7 +281,9 @@ static struct ib_pd *c4iw_allocate_pd(struct ib_device *ibdev,
        php->pdid = pdid;
        php->rhp = rhp;
        if (context) {
-               if (ib_copy_to_udata(udata, &php->pdid, sizeof(u32))) {
+               struct c4iw_alloc_pd_resp uresp = {.pdid = php->pdid};
+
+               if (ib_copy_to_udata(udata, &uresp, sizeof(uresp))) {
                        c4iw_deallocate_pd(&php->ibpd);
                        return ERR_PTR(-EFAULT);
                }
index 05f71f1..c398a1e 100644 (file)
@@ -79,4 +79,9 @@ struct c4iw_alloc_ucontext_resp {
        __u32 status_page_size;
        __u32 reserved; /* explicit padding (optional for i386) */
 };
+
+struct c4iw_alloc_pd_resp {
+       __u32 pdid;
+};
+
 #endif /* CXGB4_ABI_USER_H */