The patch titled ecryptfs: Remove unnecessary NULL checks has been removed from the -mm tree. Its filename is ecryptfs-remove-unnecessary-null-checks.patch This patch was dropped because it was folded into ecryptfs-fs-makefile-and-fs-kconfig.patch ------------------------------------------------------ Subject: ecryptfs: Remove unnecessary NULL checks From: Mike Halcrow <mhalcrow@xxxxxxxxxx> Remove unnecessary checks for NULL for values that should never be NULL. A couple of minor comment/spacing fixes. Signed-off-by: Michael Halcrow <mhalcrow@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- fs/ecryptfs/dentry.c | 4 ---- fs/ecryptfs/file.c | 24 ++++-------------------- fs/ecryptfs/inode.c | 18 ------------------ fs/ecryptfs/mmap.c | 7 ------- fs/ecryptfs/super.c | 3 --- 5 files changed, 4 insertions(+), 52 deletions(-) diff -puN fs/ecryptfs/dentry.c~ecryptfs-remove-unnecessary-null-checks fs/ecryptfs/dentry.c --- a/fs/ecryptfs/dentry.c~ecryptfs-remove-unnecessary-null-checks +++ a/fs/ecryptfs/dentry.c @@ -47,10 +47,6 @@ static int ecryptfs_d_revalidate(struct struct vfsmount *saved_vfsmount; lower_dentry = ecryptfs_dentry_to_lower(dentry); - if (!lower_dentry) { - err = 0; - goto out; - } if (!lower_dentry->d_op || !lower_dentry->d_op->d_revalidate) goto out; saved_dentry = nd->dentry; diff -puN fs/ecryptfs/file.c~ecryptfs-remove-unnecessary-null-checks fs/ecryptfs/file.c --- a/fs/ecryptfs/file.c~ecryptfs-remove-unnecessary-null-checks +++ a/fs/ecryptfs/file.c @@ -341,12 +341,6 @@ ecryptfs_fsync(struct file *file, struct mutex_unlock(&lower_dentry->d_inode->i_mutex); } } else { - if (!ecryptfs_file_to_private(file)) { - rc = -EINVAL; - ecryptfs_printk(KERN_ERR, "ecryptfs_file_to_private" - "(file=[%p]) is NULL\n", file); - goto out; - } lower_file = ecryptfs_file_to_lower(file); lower_dentry = ecryptfs_dentry_to_lower(dentry); if (lower_file->f_op && lower_file->f_op->fsync) { @@ -356,7 +350,6 @@ ecryptfs_fsync(struct file *file, struct mutex_unlock(&lower_dentry->d_inode->i_mutex); } } -out: return rc; } @@ -470,15 +463,9 @@ static int ecryptfs_fasync(int fd, struc int rc = 0; struct file *lower_file = NULL; - if (NULL != ecryptfs_file_to_private(file)) - lower_file = ecryptfs_file_to_lower(file); - else { - rc = -EINVAL; - goto out; - } + lower_file = ecryptfs_file_to_lower(file); if (lower_file->f_op && lower_file->f_op->fasync) rc = lower_file->f_op->fasync(fd, lower_file, flag); -out: return rc; } @@ -487,9 +474,7 @@ static int ecryptfs_lock(struct file *fi int rc = 0; struct file *lower_file = NULL; - if (ecryptfs_file_to_private(file)) - lower_file = ecryptfs_file_to_lower(file); - BUG_ON(!lower_file); + lower_file = ecryptfs_file_to_lower(file); rc = -EINVAL; if (!fl) goto out; @@ -517,9 +502,7 @@ static ssize_t ecryptfs_sendfile(struct struct file *lower_file = NULL; int rc = -EINVAL; - if (ecryptfs_file_to_private(file)) - lower_file = ecryptfs_file_to_lower(file); - BUG_ON(!lower_file); + lower_file = ecryptfs_file_to_lower(file); if (lower_file->f_op && lower_file->f_op->sendfile) rc = lower_file->f_op->sendfile(lower_file, ppos, count, actor, target); @@ -565,6 +548,7 @@ ecryptfs_ioctl(struct inode *inode, stru { int rc = 0; struct file *lower_file = NULL; + if (ecryptfs_file_to_private(file)) lower_file = ecryptfs_file_to_lower(file); if (lower_file && lower_file->f_op && lower_file->f_op->ioctl) diff -puN fs/ecryptfs/inode.c~ecryptfs-remove-unnecessary-null-checks fs/ecryptfs/inode.c --- a/fs/ecryptfs/inode.c~ecryptfs-remove-unnecessary-null-checks +++ a/fs/ecryptfs/inode.c @@ -152,12 +152,6 @@ ecryptfs_do_create(struct inode *directo struct dentry *lower_dir_dentry; lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); - if (IS_ERR(lower_dentry)) { - ecryptfs_printk(KERN_ERR, "ecryptfs dentry doesn't know" - "about its lower counterpart\n"); - rc = PTR_ERR(lower_dentry); - goto out; - } lower_dir_dentry = lock_parent(lower_dentry); if (unlikely(IS_ERR(lower_dir_dentry))) { ecryptfs_printk(KERN_ERR, "Error locking directory of " @@ -245,12 +239,6 @@ static int ecryptfs_initialize_file(stru struct vfsmount *lower_mnt; lower_dentry = ecryptfs_dentry_to_lower(ecryptfs_dentry); - if (IS_ERR(lower_dentry)) { - ecryptfs_printk(KERN_ERR, "ecryptfs dentry doesn't know" - "about its lower counterpart\n"); - rc = PTR_ERR(lower_dentry); - goto out; - } ecryptfs_printk(KERN_DEBUG, "lower_dentry->d_name.name = [%s]\n", lower_dentry->d_name.name); inode = ecryptfs_dentry->d_inode; @@ -827,12 +815,6 @@ int ecryptfs_truncate(struct dentry *den if (unlikely((new_length == i_size))) goto out; crypt_stat = &ecryptfs_inode_to_private(dentry->d_inode)->crypt_stat; - if (unlikely(!crypt_stat)) { - ecryptfs_printk(KERN_ERR, "NULL crypt_stat on dentry with " - "d_name.name = [%s]\n", dentry->d_name.name); - rc = -EINVAL; - goto out; - } /* Set up a fake ecryptfs file, this is used to interface with * the file in the underlying filesystem so that the * truncation has an effect there as well. */ diff -puN fs/ecryptfs/mmap.c~ecryptfs-remove-unnecessary-null-checks fs/ecryptfs/mmap.c --- a/fs/ecryptfs/mmap.c~ecryptfs-remove-unnecessary-null-checks +++ a/fs/ecryptfs/mmap.c @@ -219,11 +219,6 @@ int ecryptfs_do_readpage(struct file *fi const struct address_space_operations *lower_a_ops; dentry = file->f_dentry; - if (!ecryptfs_file_to_private(file)) { - rc = -ENOENT; - ecryptfs_printk(KERN_ERR, "No lower file info\n"); - goto out; - } lower_file = ecryptfs_file_to_lower(file); lower_dentry = ecryptfs_dentry_to_lower(dentry); inode = dentry->d_inode; @@ -645,8 +640,6 @@ static int ecryptfs_commit_write(struct mutex_lock(&lower_inode->i_mutex); crypt_stat = &ecryptfs_inode_to_private(file->f_dentry->d_inode)->crypt_stat; - BUG_ON(!crypt_stat); - BUG_ON(!lower_file); if (ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_NEW_FILE)) { ecryptfs_printk(KERN_DEBUG, "ECRYPTFS_NEW_FILE flag set in " "crypt_stat at memory location [%p]\n", crypt_stat); diff -puN fs/ecryptfs/super.c~ecryptfs-remove-unnecessary-null-checks fs/ecryptfs/super.c --- a/fs/ecryptfs/super.c~ecryptfs-remove-unnecessary-null-checks +++ a/fs/ecryptfs/super.c @@ -37,9 +37,6 @@ struct kmem_cache *ecryptfs_inode_info_c * * Called to bring an inode into existence. * - * Note that setting the self referencing pointer doesn't work here: - * i.e. ECRYPTFS_INODE_TO_PRIVATE_SM(inode) = ei; - * * Only handle allocation, setting up structures should be done in * ecryptfs_read_inode. This is because the kernel, between now and * then, will 0 out the private data pointer. _ Patches currently in -mm which might be from mhalcrow@xxxxxxxxxx are origin.patch ecryptfs-fs-makefile-and-fs-kconfig.patch ecryptfs-remove-unnecessary-null-checks.patch ecryptfs-rewrite-ecryptfs_fsync.patch ecryptfs-overhaul-file-locking.patch ecryptfs-remove-lock-propagation.patch ecryptfs-dont-muck-with-the-existing-nameidata-structures.patch ecryptfs-asm-scatterlisth-linux-scatterlisth.patch ecryptfs-support-for-larger-maximum-key-size.patch ecryptfs-add-codes-for-additional-ciphers.patch ecryptfs-unencrypted-key-size-based-on-encrypted-key-size.patch ecryptfs-packet-and-key-management-update-for-variable-key-size.patch ecryptfs-add-ecryptfs_-prefix-to-mount-options-key-size-parameter.patch ecryptfs-set-the-key-size-from-the-default-for-the-mount.patch ecryptfs-check-for-weak-keys.patch ecryptfs-add-define-values-for-cipher-codes-from-rfc2440-openpgp.patch ecryptfs-convert-bits-to-bytes.patch ecryptfs-more-elegant-aes-key-size-manipulation.patch ecryptfs-more-intelligent-use-of-tfm-objects.patch ecryptfs-remove-debugging-cruft.patch ecryptfs-get_sb_dev-fix.patch ecryptfs-validate-minimum-header-extent-size.patch ecryptfs-validate-body-size.patch ecryptfs-validate-packet-length-prior-to-parsing-add-comments.patch ecryptfs-use-the-passed-in-max-value-as-the-upper-bound.patch ecryptfs-change-the-maximum-size-check-when-writing-header.patch ecryptfs-print-the-actual-option-that-is-problematic.patch ecryptfs-add-a-maintainers-entry.patch ecryptfs-partial-signed-integer-to-size_t-conversion-updated-ii.patch ecryptfs-graceful-handling-of-mount-error.patch ecryptfs-fix-printk-format-warnings.patch ecryptfs-associate-vfsmount-with-dentry-rather-than-superblock.patch ecryptfs-mntput-lower-mount-on-umount_begin.patch vfs-make-filldir_t-and-struct-kstat-deal-in-64-bit-inode-numbers-ecryptfs.patch make-kmem_cache_destroy-return-void-ecryptfs.patch ecryptfs-inode-numbering-fixes.patch ecryptfs-versioning-fixes.patch ecryptfs-versioning-fixes-tidy.patch ecryptfs-grab-lock-on-lower_page-in-ecryptfs_sync_page.patch ecryptfs-enable-plaintext-passthrough.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html