aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/coccinelle (follow)
AgeCommit message (Collapse)AuthorFilesLines
2010-08-31Coccinelle: Add iterators/fen.cocciNicolas Palix1-0/+64
for_each_node iterators only exit normally when the loop cursor is NULL, so there is no point to call of_node_put on the final value. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-08-31Coccinelle: Add locks/mini_lock.cocciNicolas Palix1-0/+95
Find missing unlocks. This semantic match considers the specific case where the unlock is missing from an if branch, and there is a lock before the if and an unlock after the if. False positives are due to cases where the if branch represents a case where the function is supposed to exit with the lock held, or where there is some preceding function call that releases the lock. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-08-31Coccinelle: Add locks/double_lock.cocciNicolas Palix1-0/+92
Find double locks. False positives may occur when some paths cannot occur at execution, due to the values of variables, and when there is an intervening function call that releases the lock. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-08-31Coccinelle: Add locks/call_kern.cocciNicolas Palix1-0/+74
Find functions that refer to GFP_KERNEL but are called with locks held. The proposed change of converting the GFP_KERNEL is not necessarily the correct one. It may be desired to unlock the lock, or to not call the function under the lock in the first place. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-08-31Coccinelle: Move deref_null.cocci to a more appropriate directoryNicolas Palix1-0/+0
deref_null.cocci is moved to the 'null' directory which contains other null related rules. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-08-31Coccinelle: Add null/kmerr.cocciNicolas Palix1-0/+72
This semantic patch looks for kmalloc etc that are not followed by a NULL check. It only gives a report in the case where there is some error handling code later in the function, which may be helpful in determining what the error handling code for the call to kmalloc etc should be. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-08-31Coccinelle: Add null/eno.cocciNicolas Palix1-0/+20
The various basic memory allocation functions don't return ERR_PTR Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-12Add scripts/coccinelle/deref_null.cocciNicolas Palix1-0/+293
Add a Coccinelle file to identify the dereferences of NULL variables This semantic patch identifies when a variable is known to be NULL after a test, but it is still dereferenced later. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-12Add scripts/coccinelle/err_cast.cocciNicolas Palix1-0/+56
Add a Coccinelle file to use the ERR_CAST function Before the release 2.6.25, one had to use ERR_PTR(PTR_ERR(...)) to convert the pointer type of an error. Since then, the function ERR_CAST has been available for that purpose. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-12Add scripts/coccinelle/resource_size.cocciNicolas Palix1-0/+93
This semantic patch replaces explicit computations of resource size by a call to resource_size. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-12Add scripts/coccinelle/alloc/kzalloc-simple.cocciNicolas Palix1-0/+82
This semantic patch replaces a pair of calls to kmalloc and memset by a single call to kzalloc. It only looks for simple cases to avoid false positives. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-06-12Add scripts/coccinelle/alloc/drop_kmalloc_cast.cocciNicolas Palix1-0/+67
The purpose of this semantic patch is to remove useless casts, as mentioned in the Linux documentation. See Chapter 14 in Documentation/CodingStyle for more information. Signed-off-by: Nicolas Palix <npalix@diku.dk> Signed-off-by: Julia Lawall <julia@diku.dk> Signed-off-by: Michal Marek <mmarek@suse.cz>