On Tue, 24 Sep 2019, Markus Elfring wrote:

> > rc comes from check1 so it should be inherited from check1.
>
> I stumble on understanding difficulties for the currently supported
> software functionality.
>
> @check1@
> expression x;
> identifier rc;
> local idexpression lrc;
> position p;
> @@
>  lrc@rc = x@p;
>  return lrc;
>
> @check2@
> identifier check1.rc;
> position p;
> type t;
> @@
>  t rc@p;
>  ... when != rc
>
> @script:python to_do1@
> p << check1.p;
> @@
> coccilib.org.print_todo(p[0],
>                         "WARNING: An expression was assigned to a local 
> variable before it will be returned by the subsequent statement.")
>
> @script:python to_do2@
> p << check2.p;
> v << check1.rc;
> @@
> coccilib.org.print_todo(p[0],
>                         "INFO: May the local variable \""
>                         + v
>                         + "\" be deleted?")
>
>
> elfring@Sonne:~/Projekte/Linux/next-patched> spatch 
> ~/Projekte/Coccinelle/janitor/move_code_to_return2.cocci 
> arch/arm64/kernel/ptrace.c
>
> Three source code places are pointed out by the SmPL rule “to_do1”
> as it would be expected.
> Unfortunately, I miss the message “INFO: May the local variable "err" be 
> deleted?”
> for the function “ptrace_hbp_set_addr” according to the SmPL rule “to_do2”.
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/kernel/ptrace.c?id=08f103b9a9502974109fab47ea35ca8542c4e57a#n451
>
> Which adjustments will become relevant here?

In that function err is used elsewhere, so the second message should not
be printed.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to