Skip to content

Commit

Permalink
slub: remove invalid reference to list iterator variable
Browse files Browse the repository at this point in the history
If list_for_each_entry, etc complete a traversal of the list, the iterator
variable ends up pointing to an address at an offset from the list head,
and not a meaningful structure.  Thus this value should not be used after
the end of the iterator.  The patch replaces s->name by al->name, which is
referenced nearby.

This problem was found using Coccinelle (http://coccinelle.lip6.fr/).

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
  • Loading branch information
Julia Lawall authored and Pekka Enberg committed Jul 9, 2012
1 parent 4b57ad9 commit 068ce41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -5405,7 +5405,7 @@ static int __init slab_sysfs_init(void)
err = sysfs_slab_alias(al->s, al->name);
if (err)
printk(KERN_ERR "SLUB: Unable to add boot slab alias"
" %s to sysfs\n", s->name);
" %s to sysfs\n", al->name);
kfree(al);
}

Expand Down

0 comments on commit 068ce41

Please sign in to comment.