lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 12 Dec 2011 23:16:21 +0100
From:	roel <roel.kluin@...il.com>
To:	linux-mm@...ck.org, LKML <linux-kernel@...r.kernel.org>
Subject: slab: too much allocated in bootstrap head arrays?

In mm/slab.c kmem_cache_init() at /* 4) Replace the bootstrap head arrays */
it kmallocs *ptr and memcpy's with sizeof(struct arraycache_init). Is this
correct or should it maybe be with sizeof(struct arraycache) instead?

Please review, i.e. this change:
---
It appears we allocated and copied too much.

Signed-off-by: Roel Kluin <roel.kluin@...il.com>
---
 mm/slab.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index 83311c9a..6978cbf 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1617,11 +1617,11 @@ void __init kmem_cache_init(void)
 	{
 		struct array_cache *ptr;
 
-		ptr = kmalloc(sizeof(struct arraycache_init), GFP_NOWAIT);
+		ptr = kmalloc(sizeof(struct arraycache), GFP_NOWAIT);
 
 		BUG_ON(cpu_cache_get(&cache_cache) != &initarray_cache.cache);
 		memcpy(ptr, cpu_cache_get(&cache_cache),
-		       sizeof(struct arraycache_init));
+		       sizeof(struct arraycache));
 		/*
 		 * Do not assume that spinlocks can be initialized via memcpy:
 		 */
@@ -1629,12 +1629,12 @@ void __init kmem_cache_init(void)
 
 		cache_cache.array[smp_processor_id()] = ptr;
 
-		ptr = kmalloc(sizeof(struct arraycache_init), GFP_NOWAIT);
+		ptr = kmalloc(sizeof(struct arraycache), GFP_NOWAIT);
 
 		BUG_ON(cpu_cache_get(malloc_sizes[INDEX_AC].cs_cachep)
 		       != &initarray_generic.cache);
 		memcpy(ptr, cpu_cache_get(malloc_sizes[INDEX_AC].cs_cachep),
-		       sizeof(struct arraycache_init));
+		       sizeof(struct arraycache));
 		/*
 		 * Do not assume that spinlocks can be initialized via memcpy:
 		 */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ