From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422915AbdKQWVz (ORCPT ); Fri, 17 Nov 2017 17:21:55 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44836 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936758AbdKQWVt (ORCPT ); Fri, 17 Nov 2017 17:21:49 -0500 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20171117215732.GA15974@embeddedor.com> References: <20171117215732.GA15974@embeddedor.com> To: "Gustavo A. R. Silva" Cc: dhowells@redhat.com, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: Logically dead code at fs/afs/cell.c:206 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4922.1510957307.1@warthog.procyon.org.uk> Date: Fri, 17 Nov 2017 22:21:47 +0000 Message-ID: <4923.1510957307@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 17 Nov 2017 22:21:49 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gustavo A. R. Silva wrote: > Today Coverity reported a "Logically dead code" issue at fs/afs/cell.c:206: > > if (!excl) { > rcu_read_lock(); > cell = afs_lookup_cell_rcu(net, name, namesz); > rcu_read_unlock(); > if (!IS_ERR(cell)) { > if (excl) { > afs_put_cell(net, cell); > return ERR_PTR(-EEXIST); > } > goto wait_for_cell; > } > } > > The problem is that when this code block is executed, the code block > starting at line 211 makes no sense, as _excl_ can never be true. Good catch. The interior "if (excl) { ... }" statement and body needs removing entirely. Originally the outer "if (!excl)" wrapping it wasn't there. David