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: Ingo Molnar <mingo@elte.hu> Signed-off-by: Christoph Lameter <clameter@sgi.com>
This commit is contained in:
parent
a76d354629
commit
3adbefee6f
1 changed files with 21 additions and 16 deletions
37
mm/slub.c
37
mm/slub.c
|
@ -719,9 +719,10 @@ static int check_object(struct kmem_cache *s, struct page *page,
|
|||
endobject, red, s->inuse - s->objsize))
|
||||
return 0;
|
||||
} else {
|
||||
if ((s->flags & SLAB_POISON) && s->objsize < s->inuse)
|
||||
check_bytes_and_report(s, page, p, "Alignment padding", endobject,
|
||||
POISON_INUSE, s->inuse - s->objsize);
|
||||
if ((s->flags & SLAB_POISON) && s->objsize < s->inuse) {
|
||||
check_bytes_and_report(s, page, p, "Alignment padding",
|
||||
endobject, POISON_INUSE, s->inuse - s->objsize);
|
||||
}
|
||||
}
|
||||
|
||||
if (s->flags & SLAB_POISON) {
|
||||
|
@ -928,11 +929,10 @@ static int free_debug_processing(struct kmem_cache *s, struct page *page,
|
|||
return 0;
|
||||
|
||||
if (unlikely(s != page->slab)) {
|
||||
if (!PageSlab(page))
|
||||
if (!PageSlab(page)) {
|
||||
slab_err(s, page, "Attempt to free object(0x%p) "
|
||||
"outside of slab", object);
|
||||
else
|
||||
if (!page->slab) {
|
||||
} else if (!page->slab) {
|
||||
printk(KERN_ERR
|
||||
"SLUB <none>: no slab for object 0x%p.\n",
|
||||
object);
|
||||
|
@ -1041,7 +1041,7 @@ static unsigned long kmem_cache_flags(unsigned long objsize,
|
|||
*/
|
||||
if (slub_debug && (!slub_debug_slabs ||
|
||||
strncmp(slub_debug_slabs, name,
|
||||
strlen(slub_debug_slabs)) == 0))
|
||||
strlen(slub_debug_slabs)) == 0))
|
||||
flags |= slub_debug;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
return NULL;
|
||||
|
||||
zonelist = &NODE_DATA(slab_node(current->mempolicy))
|
||||
->node_zonelists[gfp_zone(flags)];
|
||||
zonelist = &NODE_DATA(
|
||||
slab_node(current->mempolicy))->node_zonelists[gfp_zone(flags)];
|
||||
for (z = zonelist->zones; *z; z++) {
|
||||
struct kmem_cache_node *n;
|
||||
|
||||
|
@ -2589,7 +2589,8 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
|
|||
goto unlock_out;
|
||||
|
||||
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);
|
||||
|
||||
if (!s || !text || !kmem_cache_open(s, flags, text,
|
||||
|
@ -3040,7 +3041,8 @@ void __init kmem_cache_init(void)
|
|||
#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",
|
||||
caches, cache_line_size(),
|
||||
slub_min_order, slub_max_order, slub_min_objects,
|
||||
|
@ -3207,7 +3209,7 @@ static int __cpuinit slab_cpuup_callback(struct notifier_block *nfb,
|
|||
}
|
||||
|
||||
static struct notifier_block __cpuinitdata slab_notifier = {
|
||||
&slab_cpuup_callback, NULL, 0
|
||||
.notifier_call = slab_cpuup_callback
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -3365,8 +3367,9 @@ static void resiliency_test(void)
|
|||
p = kzalloc(32, GFP_KERNEL);
|
||||
p[32 + sizeof(void *)] = 0x34;
|
||||
printk(KERN_ERR "\n2. kmalloc-32: Clobber next pointer/next slab"
|
||||
" 0x34 -> -0x%p\n", p);
|
||||
printk(KERN_ERR "If allocated object is overwritten then not detectable\n\n");
|
||||
" 0x34 -> -0x%p\n", p);
|
||||
printk(KERN_ERR
|
||||
"If allocated object is overwritten then not detectable\n\n");
|
||||
|
||||
validate_slab_cache(kmalloc_caches + 5);
|
||||
p = kzalloc(64, GFP_KERNEL);
|
||||
|
@ -3374,7 +3377,8 @@ static void resiliency_test(void)
|
|||
*p = 0x56;
|
||||
printk(KERN_ERR "\n3. kmalloc-64: corrupting random byte 0x56->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 + 6);
|
||||
|
||||
printk(KERN_ERR "\nB. Corruption after free\n");
|
||||
|
@ -3387,7 +3391,8 @@ static void resiliency_test(void)
|
|||
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);
|
||||
printk(KERN_ERR "\n2. kmalloc-256: Clobber 50th byte 0x9a->0x%p\n\n",
|
||||
p);
|
||||
validate_slab_cache(kmalloc_caches + 8);
|
||||
|
||||
p = kzalloc(512, GFP_KERNEL);
|
||||
|
|
Loading…
Reference in a new issue