From c55d70d736678335573a6e71d659085c9b73b5d7 Mon Sep 17 00:00:00 2001 From: David Rientjes Date: Wed, 25 Aug 2010 16:32:27 -0700 Subject: [PATCH] --- yaml --- r: 215942 b: refs/heads/master c: a016471a16b5c4d4ec8f5221575e603a3d11e5e9 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/mm/slub.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 0a78d249f14c..c6f7252dcdcf 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8de66a0c022c7c575c7481224803292cdabed4c4 +refs/heads/master: a016471a16b5c4d4ec8f5221575e603a3d11e5e9 diff --git a/trunk/mm/slub.c b/trunk/mm/slub.c index b244a5a11a98..4c5a76f505ea 100644 --- a/trunk/mm/slub.c +++ b/trunk/mm/slub.c @@ -3498,6 +3498,8 @@ static void resiliency_test(void) { u8 *p; + BUILD_BUG_ON(KMALLOC_MIN_SIZE > 16 || SLUB_PAGE_SHIFT < 10); + printk(KERN_ERR "SLUB resiliency testing\n"); printk(KERN_ERR "-----------------------\n"); printk(KERN_ERR "A. Corruption after allocation\n"); @@ -3507,7 +3509,7 @@ static void resiliency_test(void) printk(KERN_ERR "\n1. kmalloc-16: Clobber Redzone/next pointer" " 0x12->0x%p\n\n", p + 16); - validate_slab_cache(kmalloc_caches + 4); + validate_slab_cache(kmalloc_caches[4]); /* Hmmm... The next two are dangerous */ p = kzalloc(32, GFP_KERNEL); @@ -3517,7 +3519,7 @@ static void resiliency_test(void) printk(KERN_ERR "If allocated object is overwritten then not detectable\n\n"); - validate_slab_cache(kmalloc_caches + 5); + validate_slab_cache(kmalloc_caches[5]); p = kzalloc(64, GFP_KERNEL); p += 64 + (get_cycles() & 0xff) * sizeof(void *); *p = 0x56; @@ -3525,27 +3527,27 @@ static void resiliency_test(void) p); printk(KERN_ERR "If allocated object is overwritten then not detectable\n\n"); - validate_slab_cache(kmalloc_caches + 6); + validate_slab_cache(kmalloc_caches[6]); printk(KERN_ERR "\nB. Corruption after free\n"); p = kzalloc(128, GFP_KERNEL); kfree(p); *p = 0x78; printk(KERN_ERR "1. kmalloc-128: Clobber first word 0x78->0x%p\n\n", p); - validate_slab_cache(kmalloc_caches + 7); + validate_slab_cache(kmalloc_caches[7]); p = kzalloc(256, GFP_KERNEL); kfree(p); p[50] = 0x9a; printk(KERN_ERR "\n2. kmalloc-256: Clobber 50th byte 0x9a->0x%p\n\n", p); - validate_slab_cache(kmalloc_caches + 8); + validate_slab_cache(kmalloc_caches[8]); p = kzalloc(512, GFP_KERNEL); kfree(p); p[512] = 0xab; printk(KERN_ERR "\n3. kmalloc-512: Clobber redzone 0xab->0x%p\n\n", p); - validate_slab_cache(kmalloc_caches + 9); + validate_slab_cache(kmalloc_caches[9]); } #else static void resiliency_test(void) {};