From patchwork Tue Oct 25 21:37:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 9395625 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E033E60231 for ; Tue, 25 Oct 2016 21:46:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B687C28710 for ; Tue, 25 Oct 2016 21:46:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8E1429763; Tue, 25 Oct 2016 21:46:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAE4C28710 for ; Tue, 25 Oct 2016 21:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756283AbcJYVp4 (ORCPT ); Tue, 25 Oct 2016 17:45:56 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:49009 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755394AbcJYVpx (ORCPT ); Tue, 25 Oct 2016 17:45:53 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u9PLjpZs005288 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Oct 2016 21:45:52 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u9PLjnQC009133 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Oct 2016 21:45:49 GMT Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u9PLjdR3009909; Tue, 25 Oct 2016 21:45:45 GMT Received: from elgon.mountain (/41.202.241.1) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 25 Oct 2016 14:45:38 -0700 Date: Wed, 26 Oct 2016 00:37:37 +0300 From: Dan Carpenter To: Miklos Szeredi Cc: linux-fsdevel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch v3] fuse: clean up fuse_lookup_name() Message-ID: <20161025213737.GB30419@elgon.mountain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0022.oracle.com [141.146.126.234] Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We check for !outarg->nodeid twice. The first time we return success and the next time (which is dead code) we return -EIO. The correct return is the current success return and we should delete the dead code. Signed-off-by: Dan Carpenter --- I sent this patch last year, but the first time I changed the function to return -EIO, then in the second patch I messed up so that if fuse_valid_type() was false then we still returned success. But hopefully version 3 is correct. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index b3ebe512d64c..6277af3e9c45 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -321,13 +321,14 @@ int fuse_lookup_name(struct super_block *sb, u64 nodeid, const struct qstr *name fuse_lookup_init(fc, &args, nodeid, name, outarg); err = fuse_simple_request(fc, &args); - /* Zero nodeid is same as -ENOENT, but with valid timeout */ - if (err || !outarg->nodeid) + if (err) goto out_put_forget; - err = -EIO; + /* Zero nodeid is same as -ENOENT, but with valid timeout */ if (!outarg->nodeid) goto out_put_forget; + + err = -EIO; if (!fuse_valid_type(outarg->attr.mode)) goto out_put_forget;