linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Net: netfilter: Moved vmalloc call to kmalloc call
@ 2017-11-02 23:17 Charlie Sale
  2017-11-02 23:35 ` Florian Westphal
  2017-11-03  0:59 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Charlie Sale @ 2017-11-02 23:17 UTC (permalink / raw)
  To: pablo; +Cc: netdev, linux-kernel, Charlie Sale

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.

Signed-off-by: Charlie Sale <chucks.8090@gmail.com>

---
 net/netfilter/xt_hashlimit.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/netfilter/xt_hashlimit.c b/net/netfilter/xt_hashlimit.c
index 5da8746f7b88..4eab1befe03c 100644
--- a/net/netfilter/xt_hashlimit.c
+++ b/net/netfilter/xt_hashlimit.c
@@ -286,9 +286,9 @@ 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(sizeof(struct xt_hashlimit_htable) +
-	                sizeof(struct hlist_head) * size);
+
+	hinfo = kmalloc(sizeof(*hinfo) +
+			sizeof(struct hlist_head) * size, GPT_KERNEL);
 	if (hinfo == NULL)
 		return -ENOMEM;
 	*out_hinfo = hinfo;
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Net: netfilter: Moved vmalloc call to kmalloc call
  2017-11-02 23:17 [PATCH] Net: netfilter: Moved vmalloc call to kmalloc call Charlie Sale
@ 2017-11-02 23:35 ` Florian Westphal
  2017-11-03  0:59 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Westphal @ 2017-11-02 23:35 UTC (permalink / raw)
  To: Charlie Sale; +Cc: pablo, netdev, linux-kernel

Charlie Sale <chucks.8090@gmail.com> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Net: netfilter: Moved vmalloc call to kmalloc call
  2017-11-02 23:17 [PATCH] Net: netfilter: Moved vmalloc call to kmalloc call Charlie Sale
  2017-11-02 23:35 ` Florian Westphal
@ 2017-11-03  0:59 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-11-03  0:59 UTC (permalink / raw)
  To: chucks.8090; +Cc: pablo, netdev, linux-kernel

From: Charlie Sale <chucks.8090@gmail.com>
Date: Thu,  2 Nov 2017 19:17:27 -0400

> 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.
> 
> Signed-off-by: Charlie Sale <chucks.8090@gmail.com>

Since this code you are posting doesn't even compile, we have to
assume you didn't functionally test it either.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-03  0:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-02 23:17 [PATCH] Net: netfilter: Moved vmalloc call to kmalloc call Charlie Sale
2017-11-02 23:35 ` Florian Westphal
2017-11-03  0:59 ` David Miller

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).