On Fri, 1 Jul 2022, Jérémy LEFAURE wrote: > The test of an expression's address does not necessarily represent the > whole condition, it may only be a part of it. Also, an expression's > address is likely to be non-zero in every test expression, not only in > if statements. > > This change aims at detecting an address test in more complex conditions > and not only in if statements. > > Signed-off-by: Jérémy Lefaure > --- > v4 -> v5: Change semantic patch to match explicit tests to NULL + > improve commit message > v3 -> v4: Improve patch subject > v2 -> v3: Apply Julia's suggestion to have a more generic solution + adapt > commit message and file name to this new solution. > v1 -> v2: Moved disjunction on the condition itself instead of being on the > if statements. Applied, thanks. julia > > scripts/coccinelle/misc/{ifaddr.cocci => test_addr.cocci} | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > rename scripts/coccinelle/misc/{ifaddr.cocci => test_addr.cocci} (94%) > > diff --git a/scripts/coccinelle/misc/ifaddr.cocci b/scripts/coccinelle/misc/test_addr.cocci > similarity index 94% > rename from scripts/coccinelle/misc/ifaddr.cocci > rename to scripts/coccinelle/misc/test_addr.cocci > index fc92e8fcbfcb..029db9069c44 100644 > --- a/scripts/coccinelle/misc/ifaddr.cocci > +++ b/scripts/coccinelle/misc/test_addr.cocci > @@ -14,12 +14,10 @@ virtual context > > @r@ > expression x; > -statement S1,S2; > position p; > @@ > > -*if@p (&x) > - S1 else S2 > +*\(&x@p == NULL \| &x@p != NULL\) > > @script:python depends on org@ > p << r.p; > -- > 2.25.1 >