The patch titled ecryptfs: Convert ASSERT to BUG_ON has been removed from the -mm tree. Its filename is ecryptfs-convert-assert-to-bug_on.patch This patch was dropped because it was folded into ecryptfs-fs-makefile-and-fs-kconfig.patch ------------------------------------------------------ Subject: ecryptfs: Convert ASSERT to BUG_ON From: Mike Halcrow <mhalcrow@xxxxxxxxxx> Use the kernel BUG_ON() macro rather than the eCryptfs ASSERT(). Note that this temporarily renders the CONFIG_ECRYPT_DEBUG build option unused. We certainly plan on using it in the future; for now, is it okay to leave it in fs/Kconfig, or would you like to remove it? Signed-off-by: Michael Halcrow <mhalcrow@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- fs/ecryptfs/crypto.c | 16 ++++++++-------- fs/ecryptfs/ecryptfs_kernel.h | 17 ----------------- fs/ecryptfs/file.c | 4 ++-- fs/ecryptfs/inode.c | 18 +++++++++--------- fs/ecryptfs/keystore.c | 2 +- fs/ecryptfs/mmap.c | 8 ++++---- 6 files changed, 24 insertions(+), 41 deletions(-) diff -puN fs/ecryptfs/crypto.c~ecryptfs-convert-assert-to-bug_on fs/ecryptfs/crypto.c --- a/fs/ecryptfs/crypto.c~ecryptfs-convert-assert-to-bug_on +++ a/fs/ecryptfs/crypto.c @@ -259,9 +259,9 @@ static int encrypt_scatterlist(struct ec { int rc = 0; - ASSERT(crypt_stat && crypt_stat->tfm - && ECRYPTFS_CHECK_FLAG(crypt_stat->flags, - ECRYPTFS_STRUCT_INITIALIZED)); + BUG_ON(!crypt_stat || !crypt_stat->tfm + || !ECRYPTFS_CHECK_FLAG(crypt_stat->flags, + ECRYPTFS_STRUCT_INITIALIZED)); if (unlikely(ecryptfs_verbosity > 0)) { ecryptfs_printk(KERN_DEBUG, "Key size [%d]; key:\n", crypt_stat->key_size_bits / 8); @@ -484,8 +484,8 @@ int ecryptfs_encrypt_page(struct ecryptf prior_lower_page_idx = lower_page_idx; page_state = ECRYPTFS_PAGE_STATE_READ; } - ASSERT(page_state == ECRYPTFS_PAGE_STATE_MODIFIED - || page_state == ECRYPTFS_PAGE_STATE_READ); + BUG_ON(!(page_state == ECRYPTFS_PAGE_STATE_MODIFIED + || page_state == ECRYPTFS_PAGE_STATE_READ)); rc = ecryptfs_derive_iv(extent_iv, crypt_stat, (base_extent + extent_offset)); if (rc) { @@ -522,7 +522,7 @@ int ecryptfs_encrypt_page(struct ecryptf page_state = ECRYPTFS_PAGE_STATE_MODIFIED; extent_offset++; } - ASSERT(orig_byte_offset == 0); + BUG_ON(orig_byte_offset != 0); rc = ecryptfs_write_out_page(ctx, lower_page, lower_inode, 0, (lower_byte_offset + crypt_stat->extent_size)); @@ -809,8 +809,8 @@ int ecryptfs_compute_root_iv(struct ecry int rc = 0; char dst[MD5_DIGEST_SIZE]; - ASSERT(crypt_stat->iv_bytes <= MD5_DIGEST_SIZE); - ASSERT(crypt_stat->iv_bytes > 0); + BUG_ON(crypt_stat->iv_bytes > MD5_DIGEST_SIZE); + BUG_ON(crypt_stat->iv_bytes <= 0); if (!ECRYPTFS_CHECK_FLAG(crypt_stat->flags, ECRYPTFS_KEY_VALID)) { rc = -EINVAL; ecryptfs_printk(KERN_WARNING, "Session key not valid; " diff -puN fs/ecryptfs/ecryptfs_kernel.h~ecryptfs-convert-assert-to-bug_on fs/ecryptfs/ecryptfs_kernel.h --- a/fs/ecryptfs/ecryptfs_kernel.h~ecryptfs-convert-assert-to-bug_on +++ a/fs/ecryptfs/ecryptfs_kernel.h @@ -26,10 +26,6 @@ #ifndef ECRYPTFS_KERNEL_H #define ECRYPTFS_KERNEL_H -#ifdef CONFIG_ECRYPT_DEBUG -#define OBSERVE_ASSERTS 1 -#endif - #include <keys/user-type.h> #include <linux/fs.h> #include <linux/scatterlist.h> @@ -249,19 +245,6 @@ struct ecryptfs_auth_tok_list_item { struct ecryptfs_auth_tok auth_tok; }; -#ifdef OBSERVE_ASSERTS -#define ASSERT(EX) \ -do { \ - if (unlikely(!(EX))) { \ - printk(KERN_CRIT "ASSERTION FAILED: %s at %s:%d (%s)\n", #EX, \ - __FILE__, __LINE__, __FUNCTION__); \ - BUG(); \ - } \ -} while (0) -#else -#define ASSERT(EX) do { /* nothing */ } while (0) -#endif /* OBSERVE_ASSERTS */ - static inline struct ecryptfs_file_info * ecryptfs_file_to_private(struct file *file) { diff -puN fs/ecryptfs/file.c~ecryptfs-convert-assert-to-bug_on fs/ecryptfs/file.c --- a/fs/ecryptfs/file.c~ecryptfs-convert-assert-to-bug_on +++ a/fs/ecryptfs/file.c @@ -489,7 +489,7 @@ static int ecryptfs_lock(struct file *fi if (ecryptfs_file_to_private(file)) lower_file = ecryptfs_file_to_lower(file); - ASSERT(lower_file); + BUG_ON(!lower_file); rc = -EINVAL; if (!fl) goto out; @@ -519,7 +519,7 @@ static ssize_t ecryptfs_sendfile(struct if (ecryptfs_file_to_private(file)) lower_file = ecryptfs_file_to_lower(file); - ASSERT(lower_file); + BUG_ON(!lower_file); if (lower_file->f_op && lower_file->f_op->sendfile) rc = lower_file->f_op->sendfile(lower_file, ppos, count, actor, target); diff -puN fs/ecryptfs/inode.c~ecryptfs-convert-assert-to-bug_on fs/ecryptfs/inode.c --- a/fs/ecryptfs/inode.c~ecryptfs-convert-assert-to-bug_on +++ a/fs/ecryptfs/inode.c @@ -61,16 +61,16 @@ void ecryptfs_copy_inode_size(struct ino void ecryptfs_copy_attr_atime(struct inode *dest, const struct inode *src) { - ASSERT(dest != NULL); - ASSERT(src != NULL); + BUG_ON(dest != NULL); + BUG_ON(src != NULL); dest->i_atime = src->i_atime; } static void ecryptfs_copy_attr_times(struct inode *dest, const struct inode *src) { - ASSERT(dest != NULL); - ASSERT(src != NULL); + BUG_ON(dest != NULL); + BUG_ON(src != NULL); dest->i_atime = src->i_atime; dest->i_mtime = src->i_mtime; dest->i_ctime = src->i_ctime; @@ -79,8 +79,8 @@ static void ecryptfs_copy_attr_times(str static void ecryptfs_copy_attr_timesizes(struct inode *dest, const struct inode *src) { - ASSERT(dest != NULL); - ASSERT(src != NULL); + BUG_ON(!dest); + BUG_ON(!src); dest->i_atime = src->i_atime; dest->i_mtime = src->i_mtime; dest->i_ctime = src->i_ctime; @@ -89,8 +89,8 @@ static void ecryptfs_copy_attr_timesizes void ecryptfs_copy_attr_all(struct inode *dest, const struct inode *src) { - ASSERT(dest != NULL); - ASSERT(src != NULL); + BUG_ON(!dest); + BUG_ON(!src); dest->i_mode = src->i_mode; dest->i_nlink = src->i_nlink; dest->i_uid = src->i_uid; @@ -393,7 +393,7 @@ static struct dentry *ecryptfs_lookup(st lower_dentry->d_name.name); lower_inode = lower_dentry->d_inode; ecryptfs_copy_attr_atime(dir, lower_dir_dentry->d_inode); - ASSERT(atomic_read(&lower_dentry->d_count)); + BUG_ON(!atomic_read(&lower_dentry->d_count)); ecryptfs_set_dentry_private(dentry, kmem_cache_alloc(ecryptfs_dentry_info_cache, SLAB_KERNEL)); diff -puN fs/ecryptfs/keystore.c~ecryptfs-convert-assert-to-bug_on fs/ecryptfs/keystore.c --- a/fs/ecryptfs/keystore.c~ecryptfs-convert-assert-to-bug_on +++ a/fs/ecryptfs/keystore.c @@ -506,7 +506,7 @@ static int decrypt_session_key(struct ec auth_tok->session_key.encrypted_key_size); src_sg[0].page = virt_to_page(encrypted_session_key); src_sg[0].offset = 0; - ASSERT(auth_tok->session_key.encrypted_key_size < PAGE_CACHE_SIZE); + BUG_ON(auth_tok->session_key.encrypted_key_size > PAGE_CACHE_SIZE); src_sg[0].length = auth_tok->session_key.encrypted_key_size; dst_sg[0].page = virt_to_page(session_key); dst_sg[0].offset = 0; diff -puN fs/ecryptfs/mmap.c~ecryptfs-convert-assert-to-bug_on fs/ecryptfs/mmap.c --- a/fs/ecryptfs/mmap.c~ecryptfs-convert-assert-to-bug_on +++ a/fs/ecryptfs/mmap.c @@ -280,7 +280,7 @@ static int ecryptfs_readpage(struct file int rc = 0; struct ecryptfs_crypt_stat *crypt_stat; - ASSERT(file && file->f_dentry && file->f_dentry->d_inode); + BUG_ON(!(file && file->f_dentry && file->f_dentry->d_inode)); crypt_stat = &ecryptfs_inode_to_private(file->f_dentry->d_inode)->crypt_stat; if (!crypt_stat @@ -553,7 +553,7 @@ process_new_file(struct ecryptfs_crypt_s header_pages = ((crypt_stat->header_extent_size * crypt_stat->num_header_extents_at_front) / PAGE_CACHE_SIZE); - ASSERT(header_pages >= 1); + BUG_ON(header_pages < 1); while (current_header_page < header_pages) { rc = ecryptfs_grab_and_map_lower_page(&header_page, &header_virt, @@ -645,8 +645,8 @@ 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; - ASSERT(crypt_stat); - ASSERT(lower_file); + 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); _ Patches currently in -mm which might be from mhalcrow@xxxxxxxxxx are origin.patch ecryptfs-fs-makefile-and-fs-kconfig.patch ecryptfs-convert-assert-to-bug_on.patch ecryptfs-remove-pointless-bug_ons.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