Patchwork [net-next-2.6] packet: use vzalloc()

login
register
mail settings
Submitter Eric Dumazet
Date Nov. 20, 2010, 5:31 p.m.
Message ID <1290274314.2756.84.camel@edumazet-laptop>
Download mbox | patch
Permalink /patch/72355/
State Accepted
Delegated to: David Miller
Headers show

Comments

Eric Dumazet - Nov. 20, 2010, 5:31 p.m.
alloc_one_pg_vec_page() is supposed to return zeroed memory, so use
vzalloc() instead of vmalloc()

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
---
 net/packet/af_packet.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Neil Horman - Nov. 21, 2010, 12:43 a.m.
On Sat, Nov 20, 2010 at 06:31:54PM +0100, Eric Dumazet wrote:
> alloc_one_pg_vec_page() is supposed to return zeroed memory, so use
> vzalloc() instead of vmalloc()
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>

Thanks Eric!

> ---
>  net/packet/af_packet.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
> index b6372dd..422705d 100644
> --- a/net/packet/af_packet.c
> +++ b/net/packet/af_packet.c
> @@ -2367,7 +2367,7 @@ static inline char *alloc_one_pg_vec_page(unsigned long order,
>  	 * __get_free_pages failed, fall back to vmalloc
>  	 */
>  	*flags |= PGV_FROM_VMALLOC;
> -	buffer = vmalloc((1 << order) * PAGE_SIZE);
> +	buffer = vzalloc((1 << order) * PAGE_SIZE);
>  
>  	if (buffer)
>  		return buffer;
> 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Nov. 21, 2010, 6:02 p.m.
From: Neil Horman <nhorman@tuxdriver.com>
Date: Sat, 20 Nov 2010 19:43:48 -0500

> On Sat, Nov 20, 2010 at 06:31:54PM +0100, Eric Dumazet wrote:
>> alloc_one_pg_vec_page() is supposed to return zeroed memory, so use
>> vzalloc() instead of vmalloc()
>> 
>> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>> Cc: Neil Horman <nhorman@tuxdriver.com>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> 
> Thanks Eric!

Applied, thanks everyone.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index b6372dd..422705d 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2367,7 +2367,7 @@  static inline char *alloc_one_pg_vec_page(unsigned long order,
 	 * __get_free_pages failed, fall back to vmalloc
 	 */
 	*flags |= PGV_FROM_VMALLOC;
-	buffer = vmalloc((1 << order) * PAGE_SIZE);
+	buffer = vzalloc((1 << order) * PAGE_SIZE);
 
 	if (buffer)
 		return buffer;