We must not use `ist2()` if the value of `i.len` is derived from the value of
`i.ptr`:

    i.ptr = "foo";
    i.len = strlen(i.ptr);
---
 dev/coccinelle/ist.cocci | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dev/coccinelle/ist.cocci b/dev/coccinelle/ist.cocci
index 4945141b2..ea13d39d2 100644
--- a/dev/coccinelle/ist.cocci
+++ b/dev/coccinelle/ist.cocci
@@ -3,9 +3,14 @@ struct ist i;
 expression p, l;
 @@
 
+(
+ i.ptr = p;
+ i.len = strlen(i.ptr);
+|
 - i.ptr = p;
 - i.len = l;
 + i = ist2(p, l);
+)
 
 @@
 @@
-- 
2.35.1


Reply via email to