aboutsummaryrefslogtreecommitdiff
path: root/scripts/coccinelle/overflow_muldiv64.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/coccinelle/overflow_muldiv64.cocci')
-rw-r--r--scripts/coccinelle/overflow_muldiv64.cocci16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/coccinelle/overflow_muldiv64.cocci b/scripts/coccinelle/overflow_muldiv64.cocci
new file mode 100644
index 0000000000..08ec4a8de0
--- /dev/null
+++ b/scripts/coccinelle/overflow_muldiv64.cocci
@@ -0,0 +1,16 @@
+// Find muldiv64(i64, i64, x) for potential overflow
+@filter@
+typedef uint64_t;
+typedef int64_t;
+{ uint64_t, int64_t, long, unsigned long } a, b;
+expression c;
+position p;
+@@
+
+muldiv64(a,b,c)@p
+
+@script:python@
+p << filter.p;
+@@
+
+cocci.print_main("potential muldiv64() overflow", p)