Skip to contentSkip to conversation

Evolution around the information “try to delete an expanded token”?

Cocci Markus Elfring 1 participant 1 message Apr 25, 2020

lore
Share & tools
lore
#0 lore raw

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
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci