1 // SPDX-License-Identifier: GPL-2.0
3 /// Use vma_pages function on vma object instead of explicit computation.
6 // Keywords: vma_pages vma
7 // Comment: Based on resource_size.cocci
14 //----------------------------------------------------------
16 //----------------------------------------------------------
18 @r_context depends on context && !patch && !org && !report@
19 struct vm_area_struct *vma;
22 * (vma->vm_end - vma->vm_start) >> PAGE_SHIFT
24 //----------------------------------------------------------
26 //----------------------------------------------------------
28 @r_patch depends on !context && patch && !org && !report@
29 struct vm_area_struct *vma;
32 - ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT)
35 //----------------------------------------------------------
37 //----------------------------------------------------------
39 @r_org depends on !context && !patch && (org || report)@
40 struct vm_area_struct *vma;
44 (vma->vm_end@p - vma->vm_start) >> PAGE_SHIFT
46 @script:python depends on report@
51 msg="WARNING: Consider using vma_pages helper on %s" % (x)
52 coccilib.report.print_report(p[0], msg)
54 @script:python depends on org@
59 msg="WARNING: Consider using vma_pages helper on %s" % (x)
60 msg_safe=msg.replace("[","@(").replace("]",")")
61 coccilib.org.print_todo(p[0], msg_safe)