From 7654cb1ba7d0f312a6841d35d0f576db4723e8a3 Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Thu, 7 Jun 2018 07:57:16 -0700 Subject: Convert infiniband uverbs to struct_size The flows were hidden from the C compiler; expose them as a zero-length array to allow struct_size to work. Signed-off-by: Matthew Wilcox Signed-off-by: Kees Cook --- include/rdma/ib_verbs.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'include') diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 2043e1a8f851..4c6241bc2039 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -2093,10 +2093,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 { -- cgit v1.2.3 From 1c542f38ab8d30d9c852a16d49ac5a15267bbf1f Mon Sep 17 00:00:00 2001 From: Kees Cook Date: Mon, 11 Jun 2018 14:35:55 -0700 Subject: mm: Introduce kvcalloc() The kv*alloc()-family was missing kvcalloc(). Adding this allows for 2-argument multiplication conversions of kvzalloc(a * b, ...) into kvcalloc(a, b, ...). Signed-off-by: Kees Cook --- include/linux/mm.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/linux/mm.h b/include/linux/mm.h index 0e493884e6e1..a0fbb9ffe380 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -575,6 +575,11 @@ static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags) return kvmalloc(bytes, flags); } +static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) +{ + return kvmalloc_array(n, size, flags | __GFP_ZERO); +} + extern void kvfree(const void *addr); static inline atomic_t *compound_mapcount_ptr(struct page *page) -- cgit v1.2.3