* [Cocci] Evolution around the information “try to delete an expanded token”?
@ 2020-04-25 8:56 Markus Elfring
0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2020-04-25 8:56 UTC (permalink / raw)
To: Coccinelle
Hello,
I have tried another small script out for the semantic patch language
(according to the software combination “Coccinelle 1.0.8-00029-ga549b9f0”).
@display@
expression e, x != { PTR_ERR }, y;
statement is, es;
type t;
@@
*e = (t) x(...)
... when != if (<+... e ...+>) is else es
when != y(<+... e ...+>)
return e;
Source file example:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/proc/base.c?id=ab51cac00ef2859f20a73d33a53f3a8987b65e11#n3645
https://elixir.bootlin.com/linux/v5.7-rc2/source/fs/proc/base.c#L3645
// SPDX-License-Identifier: GPL-2.0
// deleted part
static struct task_struct *first_tid(struct pid *pid, int tid, loff_t f_pos,
struct pid_namespace *ns)
{
struct task_struct *pos, *task;
unsigned long nr = f_pos;
// deleted part
if (nr >= get_nr_threads(task))
goto fail;
// deleted part
pos = task = task->group_leader;
do {
if (!nr--)
goto found;
} while_each_thread(task, pos);
fail:
pos = NULL;
goto out;
found:
get_task_struct(pos);
out:
rcu_read_unlock();
return pos;
}
// deleted part
Is the following error message worth for further software development considerations?
elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch show_unchecked_return_values_before_return2.cocci ../Probe/first_tid-excerpt1.c
…
../Probe/first_tid-excerpt1.c: 16: try to delete an expanded token: pos
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-04-25 8:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-25 8:56 [Cocci] Evolution around the information “try to delete an expanded token”? 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).