User Tools

Site Tools


coccicheck

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
coccicheck [2017/03/15 10:15]
Tobin Harding Fix typos and minor gramatical erros.
coccicheck [2018/01/17 14:05] (current)
Himanshu Jha [api] updated cocci rules
Line 123: Line 123:
 Remove casting the values returned by memory allocation functions like kmalloc, kzalloc, kmem_cache_alloc,​ kmem_cache_zalloc etc. This makes an effort to find cases of casting of values returned by kmalloc, kzalloc, kcalloc, kmem_cache_alloc,​ kmem_cache_zalloc,​ kmem_cache_alloc_node,​ kmalloc_node and kzalloc_node and removes the casting as it is not required. The result in the patch case may need some reformatting. Remove casting the values returned by memory allocation functions like kmalloc, kzalloc, kmem_cache_alloc,​ kmem_cache_zalloc etc. This makes an effort to find cases of casting of values returned by kmalloc, kzalloc, kcalloc, kmem_cache_alloc,​ kmem_cache_zalloc,​ kmem_cache_alloc_node,​ kmalloc_node and kzalloc_node and removes the casting as it is not required. The result in the patch case may need some reformatting.
  
-=== kzalloc-simple.cocci ===+=== zalloc-simple.cocci ===
  
-scripts/​coccinelle/​api/​alloc/​kzalloc-simple.cocci+scripts/​coccinelle/​api/​alloc/​zalloc-simple.cocci
  
-Use kzalloc ​rather than kmalloc ​followed by memset with 0. This considers some simple cases that are common and easy to validate. Note in particular that there are no ...s in the rule, so all of the matched code has to be contiguous.+Use zeroing memory allocator function ​rather than allocator ​followed by memset with 0. This considers some simple cases that are common and easy to validate. Note in particular that there are no ...s in the rule, so all of the matched code has to be contiguous.
  
 ==== free ==== ==== free ====
coccicheck.txt ยท Last modified: 2018/01/17 14:05 by Himanshu Jha