From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zimbra.linbit.com (zimbra.linbit.com [212.69.161.123]) by mail09.linbit.com (LINBIT Mail Daemon) with ESMTP id 1C2181019A78 for ; Fri, 16 Nov 2012 13:00:48 +0100 (CET) From: Philipp Reisner To: Dan Carpenter Date: Fri, 16 Nov 2012 13:00:47 +0100 Message-ID: <4004933.3JW9EKSjmn@fat-tyre> In-Reply-To: <20121112190659.GA1865@elgon.mountain> References: <20121112190659.GA1865@elgon.mountain> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: drbd-dev@lists.linbit.com Subject: Re: [Drbd-dev] drbd: rcu_read_lock() and rcu_dereference() for tconn->net_conf List-Id: Coordination of development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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