* [PATCH nf-next] netfilter: xt_hashlimit: replace vmalloc calls with kvmalloc
@ 2025-01-26 13:19 Denis Kirjanov
2025-01-26 13:37 ` Florian Westphal
2025-03-12 15:38 ` Pablo Neira Ayuso
0 siblings, 2 replies; 3+ messages in thread
From: Denis Kirjanov @ 2025-01-26 13:19 UTC (permalink / raw)
To: pablo, kadlec; +Cc: davem, netfilter-devel, netdev, Denis Kirjanov
Replace vmalloc allocations with kvmalloc since
kvmalloc is more flexible in memory allocation
Signed-off-by: Denis Kirjanov <kirjanov@gmail.com>
---
net/netfilter/xt_hashlimit.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 0859b8f76764..4132c37dea28 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -15,7 +15,6 @@
#include <linux/random.h>
#include <linux/jhash.h>
#include <linux/slab.h>
-#include <linux/vmalloc.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/list.h>
@@ -294,8 +293,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
if (size < 16)
size = 16;
}
- /* FIXME: don't use vmalloc() here or anywhere else -HW */
- hinfo = vmalloc(struct_size(hinfo, hash, size));
+ hinfo = kvmalloc(struct_size(hinfo, hash, size), GFP_KERNEL);
if (hinfo == NULL)
return -ENOMEM;
*out_hinfo = hinfo;
@@ -303,7 +301,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
/* copy match config into hashtable config */
ret = cfg_copy(&hinfo->cfg, (void *)cfg, 3);
if (ret) {
- vfree(hinfo);
+ kvfree(hinfo);
return ret;
}
@@ -322,7 +320,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
hinfo->rnd_initialized = false;
hinfo->name = kstrdup(name, GFP_KERNEL);
if (!hinfo->name) {
- vfree(hinfo);
+ kvfree(hinfo);
return -ENOMEM;
}
spin_lock_init(&hinfo->lock);
@@ -344,7 +342,7 @@ static int htable_create(struct net *net, struct hashlimit_cfg3 *cfg,
ops, hinfo);
if (hinfo->pde == NULL) {
kfree(hinfo->name);
- vfree(hinfo);
+ kvfree(hinfo);
return -ENOMEM;
}
hinfo->net = net;
@@ -429,7 +427,7 @@ static void htable_put(struct xt_hashlimit_htable *hinfo)
cancel_delayed_work_sync(&hinfo->gc_work);
htable_selective_cleanup(hinfo, true);
kfree(hinfo->name);
- vfree(hinfo);
+ kvfree(hinfo);
}
}
--
2.47.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH nf-next] netfilter: xt_hashlimit: replace vmalloc calls with kvmalloc
2025-01-26 13:19 [PATCH nf-next] netfilter: xt_hashlimit: replace vmalloc calls with kvmalloc Denis Kirjanov
@ 2025-01-26 13:37 ` Florian Westphal
2025-03-12 15:38 ` Pablo Neira Ayuso
1 sibling, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2025-01-26 13:37 UTC (permalink / raw)
To: Denis Kirjanov; +Cc: pablo, kadlec, davem, netfilter-devel, netdev
Denis Kirjanov <kirjanov@gmail.com> wrote:
> Replace vmalloc allocations with kvmalloc since
> kvmalloc is more flexible in memory allocation
Reviewed-by: Florian Westphal <fw@strlen.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH nf-next] netfilter: xt_hashlimit: replace vmalloc calls with kvmalloc
2025-01-26 13:19 [PATCH nf-next] netfilter: xt_hashlimit: replace vmalloc calls with kvmalloc Denis Kirjanov
2025-01-26 13:37 ` Florian Westphal
@ 2025-03-12 15:38 ` Pablo Neira Ayuso
1 sibling, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2025-03-12 15:38 UTC (permalink / raw)
To: Denis Kirjanov; +Cc: kadlec, davem, netfilter-devel, netdev
On Sun, Jan 26, 2025 at 08:19:24AM -0500, Denis Kirjanov wrote:
> Replace vmalloc allocations with kvmalloc since
> kvmalloc is more flexible in memory allocation
this is applied to nf-next
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-03-12 15:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-26 13:19 [PATCH nf-next] netfilter: xt_hashlimit: replace vmalloc calls with kvmalloc Denis Kirjanov
2025-01-26 13:37 ` Florian Westphal
2025-03-12 15:38 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).