[lkml]   [2019]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Coccinelle: Checking of_node_put() calls with SmPL
> 180                         break;                         --->  Jump out of the loop without releasing it

The device node reference is released behind this for loop.

> 183 if (!of_device_is_available(state_node)) {
> 184 of_node_put(state_node);

This function call was added by the commit “cpuidle: dt: Add missing 'of_node_put()'”
on 2017-06-12.

> 185 continue; ---> Release the object references within a loop

I became curious on the applicability of an other coding style
(for a software refactoring) at this place.
How do you think about to achieve the same effect by using a goto statement
instead of two statements in such an if branch?

> 208 of_node_put(state_node); --> Release the object references within a loop
> 209 }
> 210
> 211 of_node_put(state_node); --> There may be double free here.

This information points a recurring challenge out for safe source code analysis.
How would you like to exclude the detection of false positives finally?

> This code pattern is very interesting

Thanks that you think also in this direction.

> and the coccinelle software should also recognize this pattern.

There are some open issues to consider for available analysis tools.
How will corresponding details be clarified then?


 \ /
  Last update: 2019-07-11 11:05    [W:0.019 / U:1.620 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site