Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1654384

[PATCH 3/3] netfilter: use kvmalloc xt_alloc_table_info

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject [PATCH 3/3] netfilter: use kvmalloc xt_alloc_table_info
Date 2017-05-31 18:00 +0200
Message-ID <tNecq-6Ly-25@gated-at.bofh.it> (permalink)
References <tNecp-6Ly-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Michal Hocko <mhocko@suse.com>

xt_alloc_table_info basically opencodes kvmalloc so use the library
function instead.

Cc: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: Jozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Cc: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org
Signed-off-by: Michal Hocko <mhocko@suse.com>
---
 net/netfilter/x_tables.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index 1770c1d9b37f..e1648238a9c9 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1003,14 +1003,10 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size)
 	if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > totalram_pages)
 		return NULL;
 
-	if (sz <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER))
-		info = kmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY);
-	if (!info) {
-		info = __vmalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY,
-				 PAGE_KERNEL);
-		if (!info)
-			return NULL;
-	}
+	info = kvmalloc(sz, GFP_KERNEL);
+	if (!info)
+		return NULL;
+
 	memset(info, 0, sizeof(*info));
 	info->size = size;
 	return info;
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] replace few other kvmalloc open coded variants Michal Hocko <mhocko@kernel.org> - 2017-05-31 18:00 +0200
  [PATCH 1/3] fs/file: replace alloc_fdmem with kvmalloc alternative Michal Hocko <mhocko@kernel.org> - 2017-05-31 18:00 +0200
  [PATCH 3/3] netfilter: use kvmalloc xt_alloc_table_info Michal Hocko <mhocko@kernel.org> - 2017-05-31 18:00 +0200

csiph-web