Thread (16 messages) 16 messages, 6 authors, 2023-09-05

Re: Weird sparse error WAS( [PATCH net-next v2 3/3] net/sched: act_blockcast: Introduce blockcast tc action

From: Paolo Abeni <pabeni@redhat.com>
Date: 2023-08-24 14:41:55

On Thu, 2023-08-24 at 10:30 -0400, Jamal Hadi Salim wrote:
Dan/Simon,
Can someone help explain this error on the code below:

../net/sched/act_blockcast.c:213:9: warning: context imbalance in
'tcf_blockcast_init' - different lock contexts for basic block
IIRC sparse is fooled by lock under conditionals, in this case:

       if (exists)
               spin_lock_bh(&p->tcf_lock);

a possible solution would be:

	if (exists) {
		spin_lock_bh(&p->tcf_lock);
		goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
		spin_unlock_bh(&p->tcf_lock);
	} else {
		goto_ch = tcf_action_set_ctrlact(*a, parm->action, goto_ch);
	}
	
Using some additional helpers the code could be less ugly...

Cheers,

Paolo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help