Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
From: Philipp Reisner <philipp.reisner@linbit.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: drbd-dev@lists.linbit.com
Subject: Re: [Drbd-dev] drbd: rcu_read_lock() and rcu_dereference() for tconn->net_conf
Date: Fri, 16 Nov 2012 13:00:47 +0100	[thread overview]
Message-ID: <4004933.3JW9EKSjmn@fat-tyre> (raw)
In-Reply-To: <20121112190659.GA1865@elgon.mountain>

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


           reply	other threads:[~2012-11-16 12:00 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20121112190659.GA1865@elgon.mountain>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4004933.3JW9EKSjmn@fat-tyre \
    --to=philipp.reisner@linbit.com \
    --cc=dan.carpenter@oracle.com \
    --cc=drbd-dev@lists.linbit.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox