Re: [cocci] Searching for duplicate exception handling code with SmPL?
Julia Lawall <[email protected]> Mon, 15 Jun 2026 17:50:11 +0200 (CEST)
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 15 Jun 2026, Markus Elfring wrote: > >> Examples: > >> info|arch_xen_unpopulated_init|regs|rc > >> first|./arch/arm/xen/enlighten.c|410|2 > >> tail|./arch/arm/xen/enlighten.c|410|2 > >> > >> https://elixir.bootlin.com/linux/v7.1-rc7/source/arch/arm/xen/enlighten.c#L307-L413 > >> False positive > > > > I already explained how to solve this problem. > > I found your hint too terse. > https://lore.kernel.org/cocci/[email protected]/ > https://sympa.inria.fr/sympa/arc/cocci/2026-06/msg00012.html > > > > > You should forbid a goto > > before at least one of the kfrees. You may need two rules to forbid a > > goto before each one. > > Will such a code exclusion influence the search for goto chains in special ways? > > > > >> info|device_str_attr_create|s|NULL > >> first|./arch/powerpc/perf/hv-24x7.c|506|2 > >> tail|./arch/powerpc/perf/hv-24x7.c|506|2 > > Should it be avoided anyhow that the mentioned source code positions become the same? Coccinelle has nothing built in to do that. If you want some effect you have to express that yourself in the rule. julia