Skip to contentSkip to conversation

How to improve the software according to stack overflows?

cocci Markus Elfring 1 participant 1 message Jun 29, 2025

lore
Share & tools
lore
#0 lore raw

Hello,

I converted source code from a known function definition like cec_is_switch() to another script for the semantic patch language.
https://elixir.bootlin.com/linux/v6.16-rc3/source/include/uapi/linux/cec.h#L1189-L1199

@special_display@
identifier las;
@@
*las -> num_log_addrs == 1 && las -> log_addr [ 0 ] == CEC_LOG_ADDR_UNREGISTERED && las -> primary_device_type [ 0 ] == CEC_OP_PRIM_DEVTYPE_SWITCH && ! ( las -> flags & CEC_LOG_ADDRS_FL_CDC_ONLY )

I observed questionable behaviour (with the software combination “Coccinelle 1.3.0”).
https://github.com/coccinelle/coccinelle/issues/30#issuecomment-3015721749

Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch --parse-cocci ../show_cec_is_switch.cocci …
Fatal error: exception Stack overflow

real    0m3,852s
user    0m3,742s
sys     0m0,108s

I omitted the forth conjunction element from the shown expression for another software test.

Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch --parse-cocci ../show_cec_is_switch-reduced1.cocci | grep '^|' | wc -l …
255

real    0m0,150s
user    0m0,133s
sys     0m0,028s

How will development considerations evolve then?

Regards,
Markus