Commit 3adbefee authored by Ingo Molnar's avatar Ingo Molnar Committed by Christoph Lameter
Browse files

SLUB: fix checkpatch warnings



fix checkpatch --file mm/slub.c errors and warnings.

 $ q-code-quality-compare
                                      errors   lines of code   errors/KLOC
 mm/slub.c      [before]                  22            4204           5.2
 mm/slub.c      [after]                    0            4210             0

no code changed:

    text    data     bss     dec     hex filename
   22195    8634     136   30965    78f5 slub.o.before
   22195    8634     136   30965    78f5 slub.o.after

   md5:
     93cdfbec2d6450622163c590e1064358  slub.o.before.asm
     93cdfbec2d6450622163c590e1064358  slub.o.after.asm

[clameter: rediffed against Pekka's cleanup patch, omitted
moves of the name of a function to the start of line]
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarChristoph Lameter <clameter@sgi.com>
parent a76d3546
...@@ -719,9 +719,10 @@ static int check_object(struct kmem_cache *s, struct page *page, ...@@ -719,9 +719,10 @@ static int check_object(struct kmem_cache *s, struct page *page,
endobject, red, s->inuse - s->objsize)) endobject, red, s->inuse - s->objsize))
return 0; return 0;
} else { } else {
if ((s->flags & SLAB_POISON) && s->objsize < s->inuse) if ((s->flags & SLAB_POISON) && s->objsize < s->inuse) {
check_bytes_and_report(s, page, p, "Alignment padding", endobject, check_bytes_and_report(s, page, p, "Alignment padding",
POISON_INUSE, s->inuse - s->objsize); endobject, POISON_INUSE, s->inuse - s->objsize);
}
} }
if (s->flags & SLAB_POISON) { if (s->flags & SLAB_POISON) {
...@@ -928,11 +929,10 @@ static int free_debug_processing(struct kmem_cache *s, struct page *page, ...@@ -928,11 +929,10 @@ static int free_debug_processing(struct kmem_cache *s, struct page *page,
return 0; return 0;
if (unlikely(s != page->slab)) { if (unlikely(s != page->slab)) {
if (!PageSlab(page)) if (!PageSlab(page)) {
slab_err(s, page, "Attempt to free object(0x%p) " slab_err(s, page, "Attempt to free object(0x%p) "
"outside of slab", object); "outside of slab", object);
else } else if (!page->slab) {
if (!page->slab) {
printk(KERN_ERR printk(KERN_ERR
"SLUB <none>: no slab for object 0x%p.\n", "SLUB <none>: no slab for object 0x%p.\n",
object); object);
...@@ -1041,7 +1041,7 @@ static unsigned long kmem_cache_flags(unsigned long objsize, ...@@ -1041,7 +1041,7 @@ static unsigned long kmem_cache_flags(unsigned long objsize,
*/ */
if (slub_debug && (!slub_debug_slabs || if (slub_debug && (!slub_debug_slabs ||
strncmp(slub_debug_slabs, name, strncmp(slub_debug_slabs, name,
strlen(slub_debug_slabs)) == 0)) strlen(slub_debug_slabs)) == 0))
flags |= slub_debug; flags |= slub_debug;
} }
...@@ -1330,8 +1330,8 @@ static struct page *get_any_partial(struct kmem_cache *s, gfp_t flags) ...@@ -1330,8 +1330,8 @@ static struct page *get_any_partial(struct kmem_cache *s, gfp_t flags)
get_cycles() % 1024 > s->remote_node_defrag_ratio) get_cycles() % 1024 > s->remote_node_defrag_ratio)
return NULL; return NULL;
zonelist = &NODE_DATA(slab_node(current->mempolicy)) zonelist = &NODE_DATA(
->node_zonelists[gfp_zone(flags)]; slab_node(current->mempolicy))->node_zonelists[gfp_zone(flags)];
for (z = zonelist->zones; *z; z++) { for (z = zonelist->zones; *z; z++) {
struct kmem_cache_node *n; struct kmem_cache_node *n;
...@@ -2589,7 +2589,8 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags) ...@@ -2589,7 +2589,8 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
goto unlock_out; goto unlock_out;
realsize = kmalloc_caches[index].objsize; realsize = kmalloc_caches[index].objsize;
text = kasprintf(flags & ~SLUB_DMA, "kmalloc_dma-%d", (unsigned int)realsize), text = kasprintf(flags & ~SLUB_DMA, "kmalloc_dma-%d",
(unsigned int)realsize);
s = kmalloc(kmem_size, flags & ~SLUB_DMA); s = kmalloc(kmem_size, flags & ~SLUB_DMA);
if (!s || !text || !kmem_cache_open(s, flags, text, if (!s || !text || !kmem_cache_open(s, flags, text,
...@@ -3040,7 +3041,8 @@ void __init kmem_cache_init(void) ...@@ -3040,7 +3041,8 @@ void __init kmem_cache_init(void)
#endif #endif
printk(KERN_INFO "SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, MinObjects=%d," printk(KERN_INFO
"SLUB: Genslabs=%d, HWalign=%d, Order=%d-%d, MinObjects=%d,"
" CPUs=%d, Nodes=%d\n", " CPUs=%d, Nodes=%d\n",
caches, cache_line_size(), caches, cache_line_size(),
slub_min_order, slub_max_order, slub_min_objects, slub_min_order, slub_max_order, slub_min_objects,
...@@ -3207,7 +3209,7 @@ static int __cpuinit slab_cpuup_callback(struct notifier_block *nfb, ...@@ -3207,7 +3209,7 @@ static int __cpuinit slab_cpuup_callback(struct notifier_block *nfb,
} }
static struct notifier_block __cpuinitdata slab_notifier = { static struct notifier_block __cpuinitdata slab_notifier = {
&slab_cpuup_callback, NULL, 0 .notifier_call = slab_cpuup_callback
}; };
#endif #endif
...@@ -3365,8 +3367,9 @@ static void resiliency_test(void) ...@@ -3365,8 +3367,9 @@ static void resiliency_test(void)
p = kzalloc(32, GFP_KERNEL); p = kzalloc(32, GFP_KERNEL);
p[32 + sizeof(void *)] = 0x34; p[32 + sizeof(void *)] = 0x34;
printk(KERN_ERR "\n2. kmalloc-32: Clobber next pointer/next slab" printk(KERN_ERR "\n2. kmalloc-32: Clobber next pointer/next slab"
" 0x34 -> -0x%p\n", p); " 0x34 -> -0x%p\n", p);
printk(KERN_ERR "If allocated object is overwritten then not detectable\n\n"); 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 = kzalloc(64, GFP_KERNEL);
...@@ -3374,7 +3377,8 @@ static void resiliency_test(void) ...@@ -3374,7 +3377,8 @@ static void resiliency_test(void)
*p = 0x56; *p = 0x56;
printk(KERN_ERR "\n3. kmalloc-64: corrupting random byte 0x56->0x%p\n", printk(KERN_ERR "\n3. kmalloc-64: corrupting random byte 0x56->0x%p\n",
p); p);
printk(KERN_ERR "If allocated object is overwritten then not detectable\n\n"); 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"); printk(KERN_ERR "\nB. Corruption after free\n");
...@@ -3387,7 +3391,8 @@ static void resiliency_test(void) ...@@ -3387,7 +3391,8 @@ static void resiliency_test(void)
p = kzalloc(256, GFP_KERNEL); p = kzalloc(256, GFP_KERNEL);
kfree(p); kfree(p);
p[50] = 0x9a; p[50] = 0x9a;
printk(KERN_ERR "\n2. kmalloc-256: Clobber 50th byte 0x9a->0x%p\n\n", p); 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); p = kzalloc(512, GFP_KERNEL);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment