Re: Coccinelle: pci_free_consistent: Checking when constraints

From: Julia Lawall
Date: Sun Sep 08 2019 - 04:24:03 EST

On Sun, 8 Sep 2019, Markus Elfring wrote:

> Hello,
> I have taken another look at a known script for the semantic patch language.
> The following SmPL code is used there so far.
> â
> ... when != pci_free_consistent(x,y,id,z)
> when != if (id) { ... pci_free_consistent(x,y,id,z) ... }
> when != if (y) { ... pci_free_consistent(x,y,id,z) ... }
> â
> It is specified that a specific function call should be excluded
> in a source code search.
> I do not see a need to repeat the specification twice that such a call
> could eventually happen also within a branch of another if statement.
> How do you think about to omit possibly redundant SmPL code at this place?

Have you actually run the rule and checked the impact of your proposed

The when exists below these lines has an impact. I believe that the rule
is ok as is. A single path may have no call to pci_free_consistent, but
if it has that call under one of the mentioned ifs, then the path is still
ok, and not something that an error should be reported about.