cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* Re: [Cocci] [PATCH v4] coccinelle: semantic patch for missing put_device()
       [not found] <201902151452197117145@zte.com.cn>
@ 2019-02-15  6:55 ` Julia Lawall
  2019-02-15  7:50   ` [Cocci] [v4] " Markus Elfring
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2019-02-15  6:55 UTC (permalink / raw)
  To: wen.yang99
  Cc: wang.yi59, kernel-janitors, michal.lkml, yellowriver2010,
	nicolas.palix, linux-kernel, cheng.shengyu, cocci



On Fri, 15 Feb 2019, wen.yang99@zte.com.cn wrote:

> Hi Julia, thank you very much.
>
> > > >> In a function, for variables returned by calling of_find_device_by_node(),
> > > > Do variables really get returned?
> > > > The provided pointer should usually be stored somewhere.
> > >
> > > Thank you very much, we will consider this situation and submit a next version to fix it.
> >
> > I don't know what Markus is talking about here, so I'm not sure that a
> > change is needed.
>
> I think Markus means that we need to deal with two situations:
> 1,  The return value of of_find_device_by_node () is assigned to a variable, such as:
> pdev = of_find_device_by_node(np);
> 2,  The return value of of_find_device_by_node() is assigned to a variable in a structure, such as:
> dev->pdev = of_find_device_by_node(args.np);
>
> So I plan to modify the following to capture both cases:
> -local idexpression id;
> +expression id;

I'm not sure that this is a good idea.  There is likely no need for a put
in the latter case.

julia

> ...
> id = of_find_device_by_node@p1(x)
>
> > > >> + "ERROR: missing put_device;"
> > > >Will change confidence considerations result in another fine-tuning for this message?
> > >
> > > Thank you, we will change "ERROR" to "WARNING".
> >
> > I think ERROR is fine. If it is a real positive than it is a real
> > problem. Warning is for things that look ugly, but don't have any impact
> > on the execution.
>
> OK, I will keep it.
> Thanks.
>
> Regards,
> Wen
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Cocci] [v4] coccinelle: semantic patch for missing put_device()
  2019-02-15  6:55 ` [Cocci] [PATCH v4] coccinelle: semantic patch for missing put_device() Julia Lawall
@ 2019-02-15  7:50   ` Markus Elfring
  2019-02-15  8:02     ` Julia Lawall
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Elfring @ 2019-02-15  7:50 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Yi Wang, kernel-janitors, Michal Marek, Wen Yang, Nicolas Palix,
	linux-kernel, cocci, Cheng Shengyu, Wen Yang

>> So I plan to modify the following to capture both cases:
>> -local idexpression id;
>> +expression id;
>
> I'm not sure that this is a good idea.

Why have you got doubts here?


> There is likely no need for a put in the latter case.

I have got understanding difficulties for such information.
What did you try to express with this sentence finally?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Cocci] [v4] coccinelle: semantic patch for missing put_device()
  2019-02-15  7:50   ` [Cocci] [v4] " Markus Elfring
@ 2019-02-15  8:02     ` Julia Lawall
  2019-02-15  8:19       ` Markus Elfring
  0 siblings, 1 reply; 5+ messages in thread
From: Julia Lawall @ 2019-02-15  8:02 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Yi Wang, kernel-janitors, Michal Marek, Wen Yang, Nicolas Palix,
	linux-kernel, cocci, Cheng Shengyu, Wen Yang



On Fri, 15 Feb 2019, Markus Elfring wrote:

> >> So I plan to modify the following to capture both cases:
> >> -local idexpression id;
> >> +expression id;
> >
> > I'm not sure that this is a good idea.
>
> Why have you got doubts here?
>
>
> > There is likely no need for a put in the latter case.
>
> I have got understanding difficulties for such information.
> What did you try to express with this sentence finally?

The whole goal of the semantic patch is to ensure that put_device is
called when needed.  If the value is stored in a structure, then someone
else will likely take care of calling put_device later when the structure
is destroyed.

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Cocci] [v4] coccinelle: semantic patch for missing put_device()
  2019-02-15  8:02     ` Julia Lawall
@ 2019-02-15  8:19       ` Markus Elfring
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2019-02-15  8:19 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Yi Wang, kernel-janitors, Michal Marek, Wen Yang, Nicolas Palix,
	linux-kernel, cocci, Cheng Shengyu, Wen Yang

> The whole goal of the semantic patch is to ensure that put_device is
> called when needed.

Thanks for this clarification.

The software development goal seems to be clear to some degree.


> If the value is stored in a structure,

Will any further means become relevant for the discussed data processing?


> then someone else will likely take care of calling put_device later
> when the structure is destroyed.

Such a view is reasonable.

Are there any additional source code analysis and software development challenges
to consider for safer resource management?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Cocci] [v4] coccinelle: semantic patch for missing put_device()
  2019-02-15  6:25 ` [Cocci] [PATCH v4] " Julia Lawall
@ 2019-02-15  7:11   ` Markus Elfring
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2019-02-15  7:11 UTC (permalink / raw)
  To: Julia Lawall, Wen Yang
  Cc: Yi Wang, kernel-janitors, Michal Marek, Wen Yang, Nicolas Palix,
	linux-kernel, Cheng Shengyu, cocci

>>>> In a function, for variables returned by calling of_find_device_by_node(),
>>> Do variables really get returned?
>>> The provided pointer should usually be stored somewhere.
>>
>> Thank you very much, we will consider this situation and  submit a next version to fix it.
>
> I don't know what Markus is talking about here,

I find that my feedback contained details for two items.

1. I suggested another adjustment for a wording in the evolving
   commit description.

2. Should any more case distinctions be taken into account for the data
   storage of function return values so that the shown source code search
   approach can become safer?


> so I'm not sure that a change is needed.

I am curious if there is a need for further clarifications then.


>>>> + "ERROR: missing put_device;"
>>> Will change confidence considerations result in another fine-tuning for this message?
>>
>> Thank you, we will change "ERROR" to "WARNING".
>
> I think ERROR is fine.

I have got a different software development view for the possible
severity information.


> If it is a real positive than it is a real problem.

I can agree to this information.

You specified also a precondition.
How should be achieved that the source code analysis will not point
false positives out?


> Warning is for things that look ugly,

I am also curious on how views will evolve around such ugliness.


> but don't have any impact on the execution.

I find such a restriction questionable.


Would you like to share any more ideas for safe data flow analysis
(eventually also together with your software)?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-02-15  8:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <201902151452197117145@zte.com.cn>
2019-02-15  6:55 ` [Cocci] [PATCH v4] coccinelle: semantic patch for missing put_device() Julia Lawall
2019-02-15  7:50   ` [Cocci] [v4] " Markus Elfring
2019-02-15  8:02     ` Julia Lawall
2019-02-15  8:19       ` Markus Elfring
     [not found] <201902151422261425412@zte.com.cn>
2019-02-15  6:25 ` [Cocci] [PATCH v4] " Julia Lawall
2019-02-15  7:11   ` [Cocci] [v4] " Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).