From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751289AbdEaPwP (ORCPT ); Wed, 31 May 2017 11:52:15 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33166 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750970AbdEaPwN (ORCPT ); Wed, 31 May 2017 11:52:13 -0400 From: Michal Hocko To: LKML Cc: , Andrew Morton , Michal Hocko , Florian Westphal , Jozsef Kadlecsik , Pablo Neira Ayuso Subject: [PATCH 3/3] netfilter: use kvmalloc xt_alloc_table_info Date: Wed, 31 May 2017 17:51:45 +0200 Message-Id: <20170531155145.17111-4-mhocko@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170531155145.17111-1-mhocko@kernel.org> References: <20170531155145.17111-1-mhocko@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Hocko xt_alloc_table_info basically opencodes kvmalloc so use the library function instead. Cc: Pablo Neira Ayuso Cc: Jozsef Kadlecsik Cc: Florian Westphal Cc: netfilter-devel@vger.kernel.org Signed-off-by: Michal Hocko --- 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