~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/coccinelle/api/atomic_as_refcounter.cocci

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/coccinelle/api/atomic_as_refcounter.cocci (Version linux-6.12-rc7) and /scripts/coccinelle/api/atomic_as_refcounter.cocci (Version linux-5.16.20)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 // SPDX-License-Identifier: GPL-2.0-only
  2 // Check if refcount_t type and API should be       2 // Check if refcount_t type and API should be used
  3 // instead of atomic_t type when dealing with       3 // instead of atomic_t type when dealing with refcounters
  4 //                                                  4 //
  5 // Copyright (c) 2016-2017, Elena Reshetova, I      5 // Copyright (c) 2016-2017, Elena Reshetova, Intel Corporation
  6 //                                                  6 //
  7 // Confidence: Moderate                             7 // Confidence: Moderate
  8 // URL: https://coccinelle.gitlabpages.inria.f !!   8 // URL: http://coccinelle.lip6.fr/
  9 // Options: --include-headers --very-quiet          9 // Options: --include-headers --very-quiet
 10                                                    10 
 11 virtual report                                     11 virtual report
 12                                                    12 
 13 @r1 exists@                                        13 @r1 exists@
 14 identifier a, x;                                   14 identifier a, x;
 15 position p1, p2;                                   15 position p1, p2;
 16 identifier fname =~ ".*free.*";                    16 identifier fname =~ ".*free.*";
 17 identifier fname2 =~ ".*destroy.*";                17 identifier fname2 =~ ".*destroy.*";
 18 identifier fname3 =~ ".*del.*";                    18 identifier fname3 =~ ".*del.*";
 19 identifier fname4 =~ ".*queue_work.*";             19 identifier fname4 =~ ".*queue_work.*";
 20 identifier fname5 =~ ".*schedule_work.*";          20 identifier fname5 =~ ".*schedule_work.*";
 21 identifier fname6 =~ ".*call_rcu.*";               21 identifier fname6 =~ ".*call_rcu.*";
 22                                                    22 
 23 @@                                                 23 @@
 24                                                    24 
 25 (                                                  25 (
 26  atomic_dec_and_test@p1(&(a)->x)                   26  atomic_dec_and_test@p1(&(a)->x)
 27 |                                                  27 |
 28  atomic_dec_and_lock@p1(&(a)->x, ...)              28  atomic_dec_and_lock@p1(&(a)->x, ...)
 29 |                                                  29 |
 30  atomic_long_dec_and_lock@p1(&(a)->x, ...)         30  atomic_long_dec_and_lock@p1(&(a)->x, ...)
 31 |                                                  31 |
 32  atomic_long_dec_and_test@p1(&(a)->x)              32  atomic_long_dec_and_test@p1(&(a)->x)
 33 |                                                  33 |
 34  atomic64_dec_and_test@p1(&(a)->x)                 34  atomic64_dec_and_test@p1(&(a)->x)
 35 |                                                  35 |
 36  local_dec_and_test@p1(&(a)->x)                    36  local_dec_and_test@p1(&(a)->x)
 37 )                                                  37 )
 38 ...                                                38 ...
 39 (                                                  39 (
 40  fname@p2(a, ...);                                 40  fname@p2(a, ...);
 41 |                                                  41 |
 42  fname2@p2(...);                                   42  fname2@p2(...);
 43 |                                                  43 |
 44  fname3@p2(...);                                   44  fname3@p2(...);
 45 |                                                  45 |
 46  fname4@p2(...);                                   46  fname4@p2(...);
 47 |                                                  47 |
 48  fname5@p2(...);                                   48  fname5@p2(...);
 49 |                                                  49 |
 50  fname6@p2(...);                                   50  fname6@p2(...);
 51 )                                                  51 )
 52                                                    52 
 53                                                    53 
 54 @script:python depends on report@                  54 @script:python depends on report@
 55 p1 << r1.p1;                                       55 p1 << r1.p1;
 56 p2 << r1.p2;                                       56 p2 << r1.p2;
 57 @@                                                 57 @@
 58 msg = "WARNING: atomic_dec_and_test variation  !!  58 msg = "atomic_dec_and_test variation before object free at line %s."
 59 coccilib.report.print_report(p1[0], msg % (p2[     59 coccilib.report.print_report(p1[0], msg % (p2[0].line))
 60                                                    60 
 61 @r4 exists@                                        61 @r4 exists@
 62 identifier a, x, y;                                62 identifier a, x, y;
 63 position p1, p2;                                   63 position p1, p2;
 64 identifier fname =~ ".*free.*";                    64 identifier fname =~ ".*free.*";
 65                                                    65 
 66 @@                                                 66 @@
 67                                                    67 
 68 (                                                  68 (
 69  atomic_dec_and_test@p1(&(a)->x)                   69  atomic_dec_and_test@p1(&(a)->x)
 70 |                                                  70 |
 71  atomic_dec_and_lock@p1(&(a)->x, ...)              71  atomic_dec_and_lock@p1(&(a)->x, ...)
 72 |                                                  72 |
 73  atomic_long_dec_and_lock@p1(&(a)->x, ...)         73  atomic_long_dec_and_lock@p1(&(a)->x, ...)
 74 |                                                  74 |
 75  atomic_long_dec_and_test@p1(&(a)->x)              75  atomic_long_dec_and_test@p1(&(a)->x)
 76 |                                                  76 |
 77  atomic64_dec_and_test@p1(&(a)->x)                 77  atomic64_dec_and_test@p1(&(a)->x)
 78 |                                                  78 |
 79  local_dec_and_test@p1(&(a)->x)                    79  local_dec_and_test@p1(&(a)->x)
 80 )                                                  80 )
 81 ...                                                81 ...
 82 y=a                                                82 y=a
 83 ...                                                83 ...
 84 fname@p2(y, ...);                                  84 fname@p2(y, ...);
 85                                                    85 
 86                                                    86 
 87 @script:python depends on report@                  87 @script:python depends on report@
 88 p1 << r4.p1;                                       88 p1 << r4.p1;
 89 p2 << r4.p2;                                       89 p2 << r4.p2;
 90 @@                                                 90 @@
 91 msg = "WARNING: atomic_dec_and_test variation  !!  91 msg = "atomic_dec_and_test variation before object free at line %s."
 92 coccilib.report.print_report(p1[0], msg % (p2[     92 coccilib.report.print_report(p1[0], msg % (p2[0].line))
 93                                                    93 
 94 @r2 exists@                                        94 @r2 exists@
 95 identifier a, x;                                   95 identifier a, x;
 96 position p1;                                       96 position p1;
 97 @@                                                 97 @@
 98                                                    98 
 99 (                                                  99 (
100 atomic_add_unless(&(a)->x,-1,1)@p1                100 atomic_add_unless(&(a)->x,-1,1)@p1
101 |                                                 101 |
102 atomic_long_add_unless(&(a)->x,-1,1)@p1           102 atomic_long_add_unless(&(a)->x,-1,1)@p1
103 |                                                 103 |
104 atomic64_add_unless(&(a)->x,-1,1)@p1              104 atomic64_add_unless(&(a)->x,-1,1)@p1
105 )                                                 105 )
106                                                   106 
107 @script:python depends on report@                 107 @script:python depends on report@
108 p1 << r2.p1;                                      108 p1 << r2.p1;
109 @@                                                109 @@
110 msg = "WARNING: atomic_add_unless"             !! 110 msg = "atomic_add_unless"
111 coccilib.report.print_report(p1[0], msg)          111 coccilib.report.print_report(p1[0], msg)
112                                                   112 
113 @r3 exists@                                       113 @r3 exists@
114 identifier x;                                     114 identifier x;
115 position p1;                                      115 position p1;
116 @@                                                116 @@
117                                                   117 
118 (                                                 118 (
119 x = atomic_add_return@p1(-1, ...);                119 x = atomic_add_return@p1(-1, ...);
120 |                                                 120 |
121 x = atomic_long_add_return@p1(-1, ...);           121 x = atomic_long_add_return@p1(-1, ...);
122 |                                                 122 |
123 x = atomic64_add_return@p1(-1, ...);              123 x = atomic64_add_return@p1(-1, ...);
124 )                                                 124 )
125                                                   125 
126 @script:python depends on report@                 126 @script:python depends on report@
127 p1 << r3.p1;                                      127 p1 << r3.p1;
128 @@                                                128 @@
129 msg = "WARNING: x = atomic_add_return(-1, ...) !! 129 msg = "x = atomic_add_return(-1, ...)"
130 coccilib.report.print_report(p1[0], msg)          130 coccilib.report.print_report(p1[0], msg)
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php