Skip to contentSkip to conversation

coccinelle: semantic code search for missingput_device()

PATCH Julia Lawall 3 participants 5 messages Feb 16, 2019 1 message not in the archive Kernel janitors

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 23 lines · On Sat, 16 Feb 2019, [email protected] wrote:
Quoted 10 lines
Quoted 2 lines

Thanks, We will change it to something like this:
In a function, for a local variable obtained by of_find_device_by_node()

How do you think about another wording approach?

1. Precondition:
It will be checked where the return value is stored from a call of the function “of_find_device_by_node”.

2. The source code search will be continued with …

Thanks.
This is more rigorous, we will follow your advice

Quoted 7 lines
Quoted 1 line

Thank you, but a local variable is necessary.

Would you like to take additional storage possibilities for a safer analysis approach into account?

Is the restriction “local” really sufficient when such a pointer could be copied to other variables?

We may be able to handle this situation:

Review

Quoted 5 lines
(quoted diff) +4 -0
+id = of_find_device_by_node@p1(x)
...
+    when != e1 = (T)id
+    when != e1 = &id->dev
+    when != e1 = get_device(&id->dev)

This looks good. To be double sure, you can put (T)(&id->dev) in the second case.

When you have a chance please send the revised version. As long as I don't see that it is giving many false positives, I will accept it. We don't need perfection. We need more to eliminate the memory leaks.

julia

Quoted 21 lines
Quoted 5 lines
Quoted 2 lines

But it's over 80 characters.

Long string literals can be accepted because of error message search concerns around a tool like “grep”.

Thanks.
We will follow your advice

Quoted 6 lines
Quoted 3 lines

Will any more advanced error diagnostics be eventually developed?

Hello, we are just doing the practical work in this field.

Are you aware of additional software design options from computer science and existing analysis tools?

We also use the commercial software klockwork, which will also find errors in the code, but a lot of false positives.

Regards,
Wen

#2 lore raw

Actually, upon reflection, I don't like the if (...) solution. if (id !NULL) would be better. This will also check for if (id). If having such an explicit test results in false positives, the semantic patch can be
revised. But it is better than if (...), which allow anything at all, and
could miss cases where the free should happen, but does not.

julia

#3 lore raw
In reply to Julia Lawall
Quoted 1 line

We don't need perfection.

I guess that you noticed in the meantime that I dare to propose more software development efforts in such a direction.

Quoted 1 line

We need more to eliminate the memory leaks.

Will this view evolve into further helpful and constructive clarifications?

Regards,
Markus

#4 lore raw

Hi,

Quoted 4 lines · Markus Elfring
Quoted 1 line

We don't need perfection.

I guess that you noticed in the meantime that I dare to propose more software development efforts in such a direction.

Yes, this is noticable. It is your choice, however, other people may have their reasons for other choices...

Quoted 1 line
Quoted 1 line

We need more to eliminate the memory leaks.

... like this one.

Quoted 1 line

Will this view evolve into further helpful and constructive clarifications?

Given my above, what is the evaluation of the same question to yourself?

Regards,

Wolfram

#5 lore raw
Quoted 6 lines
Quoted 4 lines
Quoted 1 line

We don't need perfection.

I guess that you noticed in the meantime that I dare to propose more software development efforts in such a direction.

Yes, this is noticable.

I am curious then if remaining change suggestions will be picked up by more software developers and reviewers.

Quoted 2 lines

It is your choice, however, other people may have their reasons for other choices...

Yes, of course.

Quoted 7 lines
Quoted 1 line
Quoted 1 line

We need more to eliminate the memory leaks.

... like this one.

Quoted 1 line

Will this view evolve into further helpful and constructive clarifications?

Given my above, what is the evaluation of the same question to yourself?

* I hope that my contributions can improve the situation also for this software area.

* Existing development tools will evolve further as usual.

Regards,
Markus