diff options
author | 2018-02-27 19:16:47 +0100 | |
---|---|---|
committer | 2018-03-02 12:39:07 +0100 | |
commit | 8419d4577641e519a49883cc80360bc348db2825 (patch) | |
tree | 94dec604fb1efdcf81acd561ff32216b7e6fb544 /coccinelle | |
parent | coccinelle: add reallocarray() coccinelle script (diff) | |
download | systemd-8419d4577641e519a49883cc80360bc348db2825.tar.gz systemd-8419d4577641e519a49883cc80360bc348db2825.tar.bz2 systemd-8419d4577641e519a49883cc80360bc348db2825.zip |
coccinelle: similar to reallocarray() let's also systematically use malloc_multiply()
Diffstat (limited to 'coccinelle')
-rw-r--r-- | coccinelle/malloc_multiply.cocci | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/coccinelle/malloc_multiply.cocci b/coccinelle/malloc_multiply.cocci new file mode 100644 index 000000000..3284edf73 --- /dev/null +++ b/coccinelle/malloc_multiply.cocci @@ -0,0 +1,20 @@ +@@ +expression q, n, m; +@@ +- q = malloc((n)*(m)) ++ q = malloc_multiply(n, m) +@@ +expression q, n, m; +@@ +- q = malloc(n*(m)) ++ q = malloc_multiply(n, m) +@@ +expression q, n, m; +@@ +- q = malloc((n)*m) ++ q = malloc_multiply(n, m) +@@ +expression q, n, m; +@@ +- q = malloc(n*m) ++ q = malloc_multiply(n, m) |