[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180214201154.10186-6-willy@infradead.org>
Date: Wed, 14 Feb 2018 12:11:51 -0800
From: Matthew Wilcox <willy@...radead.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Matthew Wilcox <mawilcox@...rosoft.com>, linux-mm@...ck.org,
Kees Cook <keescook@...omium.org>,
linux-kernel@...r.kernel.org, kernel-hardening@...ts.openwall.com,
Joe Perches <joe@...ches.com>
Subject: [PATCH v2 5/8] Convert infiniband uverbs to kvzalloc_struct
From: Matthew Wilcox <mawilcox@...rosoft.com>
Signed-off-by: Matthew Wilcox <mawilcox@...rosoft.com>
---
drivers/infiniband/core/uverbs_cmd.c | 4 ++--
include/rdma/ib_verbs.h | 5 +----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/infiniband/core/uverbs_cmd.c b/drivers/infiniband/core/uverbs_cmd.c
index 256934d1f64f..7e4114a8954d 100644
--- a/drivers/infiniband/core/uverbs_cmd.c
+++ b/drivers/infiniband/core/uverbs_cmd.c
@@ -3346,8 +3346,8 @@ int ib_uverbs_ex_create_flow(struct ib_uverbs_file *file,
goto err_uobj;
}
- flow_attr = kzalloc(sizeof(*flow_attr) + cmd.flow_attr.num_of_specs *
- sizeof(union ib_flow_spec), GFP_KERNEL);
+ flow_attr = kvzalloc_struct(flow_attr, flows,
+ cmd.flow_attr.num_of_specs, GFP_KERNEL);
if (!flow_attr) {
err = -ENOMEM;
goto err_put;
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 73b2387e3f74..895509ee7f80 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1977,10 +1977,7 @@ struct ib_flow_attr {
u32 flags;
u8 num_of_specs;
u8 port;
- /* Following are the optional layers according to user request
- * struct ib_flow_spec_xxx
- * struct ib_flow_spec_yyy
- */
+ union ib_flow_spec flows[];
};
struct ib_flow {
--
2.15.1
Powered by blists - more mailing lists