Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* Re: [Drbd-dev] drbd: rcu_read_lock() and rcu_dereference() for tconn->net_conf
       [not found] <20121112190659.GA1865@elgon.mountain>
@ 2012-11-16 12:00 ` Philipp Reisner
  0 siblings, 0 replies; only message in thread
From: Philipp Reisner @ 2012-11-16 12:00 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: drbd-dev

Am Montag, 12. November 2012, 22:06:59 schrieb Dan Carpenter:
> Hello Philipp Reisner,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 44ed167da748: "drbd: rcu_read_lock() and rcu_dereference()
> for tconn->net_conf" from Apr 19, 2011, leads to the following Smatch
> complaint:
> 
> drivers/block/drbd/drbd_state.c:566 is_valid_state()
> 	 error: we previously assumed 'nc' could be null (see line 525)
> 
> drivers/block/drbd/drbd_state.c
>    524		nc = rcu_dereference(mdev->tconn->net_conf);
>    525		if (nc) {
>                     ^^
> New check.
> 
>    526			if (!nc->two_primaries && ns.role == R_PRIMARY) {
>    527				if (ns.peer == R_PRIMARY)
[...]
>    565		else if ((ns.conn == C_VERIFY_S || ns.conn == C_VERIFY_T) &&
>    566			 (nc->verify_alg[0] == 0))
>                           ^^^^^^^^^^^^^^
> New dereference.
> Probably a false positive, but it's not immediately obvious what's going
> on.  Maybe add a comment?
> 

For developers familiar with the DRBD code it is obvious that if an online
verify may start (ns.conn == C_VERIFY_S || ns.conn == C_VERIFY_T) we have
an established connection, and that implies that nc is not NULL.

So, yes, it is a false positive.

Best,
 Phil


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-11-16 12:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20121112190659.GA1865@elgon.mountain>
2012-11-16 12:00 ` [Drbd-dev] drbd: rcu_read_lock() and rcu_dereference() for tconn->net_conf Philipp Reisner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox