diff options
author | George Kadianakis <desnacked@riseup.net> | 2019-09-25 14:13:44 +0300 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2019-09-25 14:13:44 +0300 |
commit | e77ad795c68f28e8431dc5b098fba05fcec49c19 (patch) | |
tree | 38bc0ec0593dda3befb2aa11d2c45fa9e33b24ee /scripts | |
parent | 99f75373def3520fac4f00c072748f2a0886c923 (diff) | |
parent | 387cfccee47394adeba8cbf49c130cc9b332b025 (diff) | |
download | tor-e77ad795c68f28e8431dc5b098fba05fcec49c19.tar.gz tor-e77ad795c68f28e8431dc5b098fba05fcec49c19.zip |
Merge branch 'tor-github/pr/1322'
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/coccinelle/debugmm.cocci | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/coccinelle/debugmm.cocci b/scripts/coccinelle/debugmm.cocci new file mode 100644 index 0000000000..dbd308df33 --- /dev/null +++ b/scripts/coccinelle/debugmm.cocci @@ -0,0 +1,29 @@ +// Look for use of expressions with side-effects inside of debug logs. +// +// This script detects expressions like ++E, --E, E++, and E-- inside of +// calls to log_debug(). +// +// The log_debug() macro exits early if debug logging is not enabled, +// potentially causing problems if its arguments have side-effects. + +@@ +expression E; +@@ +*log_debug(... , <+... --E ...+>, ... ); + + +@@ +expression E; +@@ +*log_debug(... , <+... ++E ...+>, ... ); + +@@ +expression E; +@@ +*log_debug(... , <+... E-- ...+>, ... ); + + +@@ +expression E; +@@ +*log_debug(... , <+... E++ ...+>, ... ); |