Re: [PATCH] Net: netfilter: Moved vmalloc call to kmalloc call
From: Florian Westphal
Date: Thu Nov 02 2017 - 19:36:29 EST
Charlie Sale <chucks.8090@xxxxxxxxx> wrote:
> Fixed FIXME comment in code my changing a vmalloc call
> to a kmalloc call. Thought it would be a good place to
> start for a first patch.
Please at least compile test your patches.
> - /* FIXME: don't use vmalloc() here or anywhere else -HW */
> - hinfo = vmalloc(sizeof(struct xt_hashlimit_htable) +
> - sizeof(struct hlist_head) * size);
> +
> + hinfo = kmalloc(sizeof(*hinfo) +
> + sizeof(struct hlist_head) * size, GPT_KERNEL);
If anything this should be switched to kvmalloc, not kmalloc.
Also, hinfo cannot be free'd via vfree after this change, so you need to
adjust all free operations too.