Received: by 10.223.176.46 with SMTP id f43csp359677wra; Thu, 18 Jan 2018 18:41:49 -0800 (PST) X-Google-Smtp-Source: ACJfBos7/MMqzj0NOzkg4wlhSjTdYce6nRu3e7OskxRye7/ZYblBH5seceBTk5lozbh7ceziK+cG X-Received: by 10.98.222.198 with SMTP id h189mr30592471pfg.150.1516329709602; Thu, 18 Jan 2018 18:41:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516329709; cv=none; d=google.com; s=arc-20160816; b=PtKmY+KNuxp2kfjh4vSxeLVtcx5psDNIL3GkipiKxcCWDXJhDsXv4yNSodOmCADpIe GQ0Nu7CQInUdqRvX9D74ScZBOaWJsNUQvuX6vUPcUgiYkJOlIPIiWDGYN2oTpY7Czfza FbDmcB4zGoEmYz6e4janJyfVrArDy8BhoYVrCG3yIC191lvR2NhG7owxraSykCEBXWsc xhjR8s+h/dHOMkmluIvjmcnKUfUiLlk6XN9QLrMD6zrMS53fJaXX0YFz2QMt+rR9FV2V bnzjGEwGJSUmxCWY+Z45mv3D1H8PWotuoWAmEpD5oS2j4Wp7NxwBceyMEwyg3Bv9wCBC JLmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=Es74/+x0p5ZgD8OG+MdguQzdSgsDts8Yi4sxWBX1erA=; b=x4QJSdjlV2PPgKS7gBlHZcWWFzg7HCd90PoOzhyec1P+bLY225IOMpHSZyulaBZFdw ow7TH5CXapHu+eOtXbUE3IPzRYQ0tb/EEjG7dkzGx1HnyrizBXXIOzF2UosHEff2GML3 iqRaa2AhcXKO5AveWnXV4EojYo1fsRwLYikAzXoULFLFfUOIaBVDtblk3qnfheX2WrXG OSSz9RFAcBtKI53EsvXaEYipGR1G7L2e/2Z5wwEhV83ODAKKKLPIzNC96p9SkGB0UM+Z eQcWBtObFtvVyiSSdsQ5jK1HZ+suGkznPrL7p3tiGwxGtTeUyS6SyYc4sjyWRlHv9niV QJBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=PnbvKkOS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v22si2662257pfd.22.2018.01.18.18.41.35; Thu, 18 Jan 2018 18:41:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=PnbvKkOS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755307AbeASCkh (ORCPT + 99 others); Thu, 18 Jan 2018 21:40:37 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:34014 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754836AbeASCka (ORCPT ); Thu, 18 Jan 2018 21:40:30 -0500 Received: by mail-pg0-f65.google.com with SMTP id r19so302774pgn.1; Thu, 18 Jan 2018 18:40:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id; bh=Es74/+x0p5ZgD8OG+MdguQzdSgsDts8Yi4sxWBX1erA=; b=PnbvKkOSGDU+yIEeNGbW33HigHEWU7Gr1boGORL1WHZzTgwtaVvNnaJArke3zywsKi gkwQUM78sm/JGNFmb788eLoJvOKhbqE0GPGIyqdl9+oCSakHoQEyJiyvVQfpQnPRkV0U oFfSBwjd1zSvzgUHVx2kwk24kLpTf4xTkzxRIDdHUUdXQSWhWOt5qdGCCVemUyT4tWAS csOF8hcvTz9+VnzXoc9zaOe521pP+c567VQvnpURMhW9WidDKgaNlj9dm3IGxvtZQ7A+ /q/CehWVbNe23J23iow9h1YmUNjuXjCxpp1qkr5FykqeRh7Nz8SiTAjdOOV96W6dX+me PSTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=Es74/+x0p5ZgD8OG+MdguQzdSgsDts8Yi4sxWBX1erA=; b=tYwW1yKWwmiDmbwO+A3z+j+fhdJVPhgZOL3jnFYORY3utzJR8xr4jW5k0EJdFSHel9 vwx9wgWJGCgktK12Sl2Ouil+mJL1OKV3P351U+fwyuve8lHrEwRQ0oKMZIrMy3M+xPvs QTxJjaMsPp8PnXzGq2S4Pgn8rPomCxOZhhMbmhnxwxfWIFgdY14EbI7qd771O0hIWRdo 8+eSQuU56sX3xcRqIb6ra7/EFFquy4qjN4AzwSxF3+htb3XSfUXasr8A5cCWbnEDDoa3 /+tlCNamKjrPnLCoXIKh766fE9/wIXMatPR07kGdmIHTXeWNQlSlWY4fkN1cREkrjVIa bPqg== X-Gm-Message-State: AKwxyteNQ46As9Qttcm5q6Qs2KjLELwl1ZfQ/CnGsh5VQu5obSshB6+L NtQXJNfSfkm5aQx8reYzeStx4A== X-Received: by 10.98.200.78 with SMTP id z75mr3630742pff.114.1516329629407; Thu, 18 Jan 2018 18:40:29 -0800 (PST) Received: from localhost (108-223-40-66.lightspeed.sntcca.sbcglobal.net. [108.223.40.66]) by smtp.gmail.com with ESMTPSA id q10sm14463959pfh.178.2018.01.18.18.40.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Jan 2018 18:40:28 -0800 (PST) From: Guenter Roeck To: Tyler Hicks Cc: ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org, Guenter Roeck Subject: [PATCH] ecryptfs: lookup: Don't check if mount_crypt_stat is NULL Date: Thu, 18 Jan 2018 18:40:25 -0800 Message-Id: <1516329625-19236-1-git-send-email-linux@roeck-us.net> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org mount_crypt_stat is assigned to &ecryptfs_superblock_to_private(ecryptfs_dentry->d_sb)->mount_crypt_stat, and mount_crypt_stat is not the first object in struct ecryptfs_sb_info. mount_crypt_stat is therefore never NULL. At the same time, no crash in ecryptfs_lookup() has been reported, and the lookup functions in other file systems don't check if d_sb is NULL either. Given that, remove the NULL check. Signed-off-by: Guenter Roeck --- fs/ecryptfs/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 847904aa63a9..97d17eaeba07 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c @@ -395,8 +395,7 @@ static struct dentry *ecryptfs_lookup(struct inode *ecryptfs_dir_inode, mount_crypt_stat = &ecryptfs_superblock_to_private( ecryptfs_dentry->d_sb)->mount_crypt_stat; - if (mount_crypt_stat - && (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES)) { + if (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES) { rc = ecryptfs_encrypt_and_encode_filename( &encrypted_and_encoded_name, &len, mount_crypt_stat, name, len); -- 2.7.4