Commit 5dda6992 authored by Michael Halcrow's avatar Michael Halcrow Committed by Linus Torvalds

eCryptfs: remove assignments in if-statements

Remove assignments in if-statements.
Signed-off-by: default avatarMichael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 45eaab79
...@@ -1277,8 +1277,8 @@ static int ecryptfs_read_header_region(char *data, struct dentry *dentry, ...@@ -1277,8 +1277,8 @@ static int ecryptfs_read_header_region(char *data, struct dentry *dentry,
mm_segment_t oldfs; mm_segment_t oldfs;
int rc; int rc;
if ((rc = ecryptfs_open_lower_file(&lower_file, dentry, mnt, rc = ecryptfs_open_lower_file(&lower_file, dentry, mnt, O_RDONLY);
O_RDONLY))) { if (rc) {
printk(KERN_ERR printk(KERN_ERR
"Error opening lower_file to read header region\n"); "Error opening lower_file to read header region\n");
goto out; goto out;
...@@ -1289,7 +1289,8 @@ static int ecryptfs_read_header_region(char *data, struct dentry *dentry, ...@@ -1289,7 +1289,8 @@ static int ecryptfs_read_header_region(char *data, struct dentry *dentry,
rc = lower_file->f_op->read(lower_file, (char __user *)data, rc = lower_file->f_op->read(lower_file, (char __user *)data,
ECRYPTFS_DEFAULT_EXTENT_SIZE, &lower_file->f_pos); ECRYPTFS_DEFAULT_EXTENT_SIZE, &lower_file->f_pos);
set_fs(oldfs); set_fs(oldfs);
if ((rc = ecryptfs_close_lower_file(lower_file))) { rc = ecryptfs_close_lower_file(lower_file);
if (rc) {
printk(KERN_ERR "Error closing lower_file\n"); printk(KERN_ERR "Error closing lower_file\n");
goto out; goto out;
} }
...@@ -1951,9 +1952,10 @@ ecryptfs_add_new_key_tfm(struct ecryptfs_key_tfm **key_tfm, char *cipher_name, ...@@ -1951,9 +1952,10 @@ ecryptfs_add_new_key_tfm(struct ecryptfs_key_tfm **key_tfm, char *cipher_name,
strncpy(tmp_tfm->cipher_name, cipher_name, strncpy(tmp_tfm->cipher_name, cipher_name,
ECRYPTFS_MAX_CIPHER_NAME_SIZE); ECRYPTFS_MAX_CIPHER_NAME_SIZE);
tmp_tfm->key_size = key_size; tmp_tfm->key_size = key_size;
if ((rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm, rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm,
tmp_tfm->cipher_name, tmp_tfm->cipher_name,
&tmp_tfm->key_size))) { &tmp_tfm->key_size);
if (rc) {
printk(KERN_ERR "Error attempting to initialize key TFM " printk(KERN_ERR "Error attempting to initialize key TFM "
"cipher with name = [%s]; rc = [%d]\n", "cipher with name = [%s]; rc = [%d]\n",
tmp_tfm->cipher_name, rc); tmp_tfm->cipher_name, rc);
...@@ -1988,7 +1990,8 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm, ...@@ -1988,7 +1990,8 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm,
} }
} }
mutex_unlock(&key_tfm_list_mutex); mutex_unlock(&key_tfm_list_mutex);
if ((rc = ecryptfs_add_new_key_tfm(&key_tfm, cipher_name, 0))) { rc = ecryptfs_add_new_key_tfm(&key_tfm, cipher_name, 0);
if (rc) {
printk(KERN_ERR "Error adding new key_tfm to list; rc = [%d]\n", printk(KERN_ERR "Error adding new key_tfm to list; rc = [%d]\n",
rc); rc);
goto out; goto out;
......
...@@ -230,8 +230,9 @@ static int ecryptfs_open(struct inode *inode, struct file *file) ...@@ -230,8 +230,9 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
lower_flags &= ~O_APPEND; lower_flags &= ~O_APPEND;
lower_mnt = ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry); lower_mnt = ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry);
/* Corresponding fput() in ecryptfs_release() */ /* Corresponding fput() in ecryptfs_release() */
if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt, rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt,
lower_flags))) { lower_flags);
if (rc) {
ecryptfs_printk(KERN_ERR, "Error opening lower file\n"); ecryptfs_printk(KERN_ERR, "Error opening lower file\n");
goto out_puts; goto out_puts;
} }
...@@ -300,7 +301,8 @@ static int ecryptfs_release(struct inode *inode, struct file *file) ...@@ -300,7 +301,8 @@ static int ecryptfs_release(struct inode *inode, struct file *file)
struct inode *lower_inode = ecryptfs_inode_to_lower(inode); struct inode *lower_inode = ecryptfs_inode_to_lower(inode);
int rc; int rc;
if ((rc = ecryptfs_close_lower_file(lower_file))) { rc = ecryptfs_close_lower_file(lower_file);
if (rc) {
printk(KERN_ERR "Error closing lower_file\n"); printk(KERN_ERR "Error closing lower_file\n");
goto out; goto out;
} }
......
...@@ -202,8 +202,9 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry) ...@@ -202,8 +202,9 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry)
lower_flags = ((O_CREAT | O_TRUNC) & O_ACCMODE) | O_RDWR; lower_flags = ((O_CREAT | O_TRUNC) & O_ACCMODE) | O_RDWR;
lower_mnt = ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry); lower_mnt = ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry);
/* Corresponding fput() at end of this function */ /* Corresponding fput() at end of this function */
if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt, rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt,
lower_flags))) { lower_flags);
if (rc) {
ecryptfs_printk(KERN_ERR, ecryptfs_printk(KERN_ERR,
"Error opening dentry; rc = [%i]\n", rc); "Error opening dentry; rc = [%i]\n", rc);
goto out; goto out;
...@@ -229,7 +230,8 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry) ...@@ -229,7 +230,8 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry)
} }
rc = grow_file(ecryptfs_dentry, lower_file, inode, lower_inode); rc = grow_file(ecryptfs_dentry, lower_file, inode, lower_inode);
out_fput: out_fput:
if ((rc = ecryptfs_close_lower_file(lower_file))) rc = ecryptfs_close_lower_file(lower_file);
if (rc)
printk(KERN_ERR "Error closing lower_file\n"); printk(KERN_ERR "Error closing lower_file\n");
out: out:
return rc; return rc;
...@@ -779,8 +781,9 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) ...@@ -779,8 +781,9 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
lower_dentry = ecryptfs_dentry_to_lower(dentry); lower_dentry = ecryptfs_dentry_to_lower(dentry);
/* This dget & mntget is released through fput at out_fput: */ /* This dget & mntget is released through fput at out_fput: */
lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt, rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt,
O_RDWR))) { O_RDWR);
if (rc) {
ecryptfs_printk(KERN_ERR, ecryptfs_printk(KERN_ERR,
"Error opening dentry; rc = [%i]\n", rc); "Error opening dentry; rc = [%i]\n", rc);
goto out_free; goto out_free;
...@@ -813,11 +816,12 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) ...@@ -813,11 +816,12 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
end_pos_in_page = ((new_length - 1) & ~PAGE_CACHE_MASK); end_pos_in_page = ((new_length - 1) & ~PAGE_CACHE_MASK);
} }
if (end_pos_in_page != (PAGE_CACHE_SIZE - 1)) { if (end_pos_in_page != (PAGE_CACHE_SIZE - 1)) {
if ((rc = ecryptfs_write_zeros(&fake_ecryptfs_file, rc = ecryptfs_write_zeros(&fake_ecryptfs_file,
index, index,
(end_pos_in_page + 1), (end_pos_in_page + 1),
((PAGE_CACHE_SIZE - 1) ((PAGE_CACHE_SIZE - 1)
- end_pos_in_page)))) { - end_pos_in_page));
if (rc) {
printk(KERN_ERR "Error attempting to zero out " printk(KERN_ERR "Error attempting to zero out "
"the remainder of the end page on " "the remainder of the end page on "
"reducing truncate; rc = [%d]\n", rc); "reducing truncate; rc = [%d]\n", rc);
...@@ -849,7 +853,8 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length) ...@@ -849,7 +853,8 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
= CURRENT_TIME; = CURRENT_TIME;
mark_inode_dirty_sync(inode); mark_inode_dirty_sync(inode);
out_fput: out_fput:
if ((rc = ecryptfs_close_lower_file(lower_file))) rc = ecryptfs_close_lower_file(lower_file);
if (rc)
printk(KERN_ERR "Error closing lower_file\n"); printk(KERN_ERR "Error closing lower_file\n");
out_free: out_free:
if (ecryptfs_file_to_private(&fake_ecryptfs_file)) if (ecryptfs_file_to_private(&fake_ecryptfs_file))
...@@ -917,8 +922,9 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) ...@@ -917,8 +922,9 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
lower_flags = O_RDONLY; lower_flags = O_RDONLY;
if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, rc = ecryptfs_open_lower_file(&lower_file, lower_dentry,
lower_mnt, lower_flags))) { lower_mnt, lower_flags);
if (rc) {
printk(KERN_ERR printk(KERN_ERR
"Error opening lower file; rc = [%d]\n", rc); "Error opening lower file; rc = [%d]\n", rc);
mutex_unlock(&crypt_stat->cs_mutex); mutex_unlock(&crypt_stat->cs_mutex);
...@@ -926,7 +932,8 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia) ...@@ -926,7 +932,8 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
} }
mount_crypt_stat = &ecryptfs_superblock_to_private( mount_crypt_stat = &ecryptfs_superblock_to_private(
dentry->d_sb)->mount_crypt_stat; dentry->d_sb)->mount_crypt_stat;
if ((rc = ecryptfs_read_metadata(dentry, lower_file))) { rc = ecryptfs_read_metadata(dentry, lower_file);
if (rc) {
if (!(mount_crypt_stat->flags if (!(mount_crypt_stat->flags
& ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) { & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) {
rc = -EIO; rc = -EIO;
......
...@@ -436,7 +436,8 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok, ...@@ -436,7 +436,8 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
size_t netlink_message_length; size_t netlink_message_length;
int rc; int rc;
if ((rc = ecryptfs_get_auth_tok_sig(&auth_tok_sig, auth_tok))) { rc = ecryptfs_get_auth_tok_sig(&auth_tok_sig, auth_tok);
if (rc) {
printk(KERN_ERR "Unrecognized auth tok type: [%d]\n", printk(KERN_ERR "Unrecognized auth tok type: [%d]\n",
auth_tok->token_type); auth_tok->token_type);
goto out; goto out;
...@@ -569,8 +570,9 @@ parse_tag_1_packet(struct ecryptfs_crypt_stat *crypt_stat, ...@@ -569,8 +570,9 @@ parse_tag_1_packet(struct ecryptfs_crypt_stat *crypt_stat,
goto out; goto out;
} }
(*new_auth_tok) = &auth_tok_list_item->auth_tok; (*new_auth_tok) = &auth_tok_list_item->auth_tok;
if ((rc = parse_packet_length(&data[(*packet_size)], &body_size, rc = parse_packet_length(&data[(*packet_size)], &body_size,
&length_size))) { &length_size);
if (rc) {
printk(KERN_WARNING "Error parsing packet length; " printk(KERN_WARNING "Error parsing packet length; "
"rc = [%d]\n", rc); "rc = [%d]\n", rc);
goto out_free; goto out_free;
...@@ -702,8 +704,9 @@ parse_tag_3_packet(struct ecryptfs_crypt_stat *crypt_stat, ...@@ -702,8 +704,9 @@ parse_tag_3_packet(struct ecryptfs_crypt_stat *crypt_stat,
goto out; goto out;
} }
(*new_auth_tok) = &auth_tok_list_item->auth_tok; (*new_auth_tok) = &auth_tok_list_item->auth_tok;
if ((rc = parse_packet_length(&data[(*packet_size)], &body_size, rc = parse_packet_length(&data[(*packet_size)], &body_size,
&length_size))) { &length_size);
if (rc) {
printk(KERN_WARNING "Error parsing packet length; rc = [%d]\n", printk(KERN_WARNING "Error parsing packet length; rc = [%d]\n",
rc); rc);
goto out_free; goto out_free;
...@@ -849,8 +852,9 @@ parse_tag_11_packet(unsigned char *data, unsigned char *contents, ...@@ -849,8 +852,9 @@ parse_tag_11_packet(unsigned char *data, unsigned char *contents,
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
if ((rc = parse_packet_length(&data[(*packet_size)], &body_size, rc = parse_packet_length(&data[(*packet_size)], &body_size,
&length_size))) { &length_size);
if (rc) {
printk(KERN_WARNING "Invalid tag 11 packet format\n"); printk(KERN_WARNING "Invalid tag 11 packet format\n");
goto out; goto out;
} }
...@@ -1052,9 +1056,10 @@ decrypt_passphrase_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok, ...@@ -1052,9 +1056,10 @@ decrypt_passphrase_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
crypt_stat->cipher, rc); crypt_stat->cipher, rc);
goto out; goto out;
} }
if ((rc = virt_to_scatterlist(auth_tok->session_key.encrypted_key, rc = virt_to_scatterlist(auth_tok->session_key.encrypted_key,
auth_tok->session_key.encrypted_key_size, auth_tok->session_key.encrypted_key_size,
&src_sg, 1)) != 1) { &src_sg, 1);
if (rc != 1) {
printk(KERN_ERR "Internal error whilst attempting to convert " printk(KERN_ERR "Internal error whilst attempting to convert "
"auth_tok->session_key.encrypted_key to scatterlist; " "auth_tok->session_key.encrypted_key to scatterlist; "
"expected rc = 1; got rc = [%d]. " "expected rc = 1; got rc = [%d]. "
...@@ -1064,9 +1069,10 @@ decrypt_passphrase_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok, ...@@ -1064,9 +1069,10 @@ decrypt_passphrase_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
} }
auth_tok->session_key.decrypted_key_size = auth_tok->session_key.decrypted_key_size =
auth_tok->session_key.encrypted_key_size; auth_tok->session_key.encrypted_key_size;
if ((rc = virt_to_scatterlist(auth_tok->session_key.decrypted_key, rc = virt_to_scatterlist(auth_tok->session_key.decrypted_key,
auth_tok->session_key.decrypted_key_size, auth_tok->session_key.decrypted_key_size,
&dst_sg, 1)) != 1) { &dst_sg, 1);
if (rc != 1) {
printk(KERN_ERR "Internal error whilst attempting to convert " printk(KERN_ERR "Internal error whilst attempting to convert "
"auth_tok->session_key.decrypted_key to scatterlist; " "auth_tok->session_key.decrypted_key to scatterlist; "
"expected rc = 1; got rc = [%d]\n", rc); "expected rc = 1; got rc = [%d]\n", rc);
...@@ -1236,18 +1242,17 @@ int ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat, ...@@ -1236,18 +1242,17 @@ int ecryptfs_parse_packet_set(struct ecryptfs_crypt_stat *crypt_stat,
"Considering cadidate auth tok:\n"); "Considering cadidate auth tok:\n");
ecryptfs_dump_auth_tok(candidate_auth_tok); ecryptfs_dump_auth_tok(candidate_auth_tok);
} }
if ((rc = ecryptfs_get_auth_tok_sig(&candidate_auth_tok_sig, rc = ecryptfs_get_auth_tok_sig(&candidate_auth_tok_sig,
candidate_auth_tok))) { candidate_auth_tok);
if (rc) {
printk(KERN_ERR printk(KERN_ERR
"Unrecognized candidate auth tok type: [%d]\n", "Unrecognized candidate auth tok type: [%d]\n",
candidate_auth_tok->token_type); candidate_auth_tok->token_type);
rc = -EINVAL; rc = -EINVAL;
goto out_wipe_list; goto out_wipe_list;
} }
if ((rc = ecryptfs_find_auth_tok_for_sig( ecryptfs_find_auth_tok_for_sig(&matching_auth_tok, crypt_stat,
&matching_auth_tok, crypt_stat, candidate_auth_tok_sig);
candidate_auth_tok_sig)))
rc = 0;
if (matching_auth_tok) { if (matching_auth_tok) {
found_auth_tok = 1; found_auth_tok = 1;
goto found_matching_auth_tok; goto found_matching_auth_tok;
...@@ -1605,9 +1610,9 @@ write_tag_3_packet(char *dest, size_t *remaining_bytes, ...@@ -1605,9 +1610,9 @@ write_tag_3_packet(char *dest, size_t *remaining_bytes,
ecryptfs_printk(KERN_DEBUG, "Session key encryption key:\n"); ecryptfs_printk(KERN_DEBUG, "Session key encryption key:\n");
ecryptfs_dump_hex(session_key_encryption_key, 16); ecryptfs_dump_hex(session_key_encryption_key, 16);
} }
if ((rc = virt_to_scatterlist(crypt_stat->key, rc = virt_to_scatterlist(crypt_stat->key, key_rec->enc_key_size,
key_rec->enc_key_size, &src_sg, 1)) &src_sg, 1);
!= 1) { if (rc != 1) {
ecryptfs_printk(KERN_ERR, "Error generating scatterlist " ecryptfs_printk(KERN_ERR, "Error generating scatterlist "
"for crypt_stat session key; expected rc = 1; " "for crypt_stat session key; expected rc = 1; "
"got rc = [%d]. key_rec->enc_key_size = [%d]\n", "got rc = [%d]. key_rec->enc_key_size = [%d]\n",
...@@ -1615,9 +1620,9 @@ write_tag_3_packet(char *dest, size_t *remaining_bytes, ...@@ -1615,9 +1620,9 @@ write_tag_3_packet(char *dest, size_t *remaining_bytes,
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
} }
if ((rc = virt_to_scatterlist(key_rec->enc_key, rc = virt_to_scatterlist(key_rec->enc_key, key_rec->enc_key_size,
key_rec->enc_key_size, &dst_sg, 1)) &dst_sg, 1);
!= 1) { if (rc != 1) {
ecryptfs_printk(KERN_ERR, "Error generating scatterlist " ecryptfs_printk(KERN_ERR, "Error generating scatterlist "
"for crypt_stat encrypted session key; " "for crypt_stat encrypted session key; "
"expected rc = 1; got rc = [%d]. " "expected rc = 1; got rc = [%d]. "
......
...@@ -188,10 +188,11 @@ static int ecryptfs_init_global_auth_toks( ...@@ -188,10 +188,11 @@ static int ecryptfs_init_global_auth_toks(
list_for_each_entry(global_auth_tok, list_for_each_entry(global_auth_tok,
&mount_crypt_stat->global_auth_tok_list, &mount_crypt_stat->global_auth_tok_list,
mount_crypt_stat_list) { mount_crypt_stat_list) {
if ((rc = ecryptfs_keyring_auth_tok_for_sig( rc = ecryptfs_keyring_auth_tok_for_sig(
&global_auth_tok->global_auth_tok_key, &global_auth_tok->global_auth_tok_key,
&global_auth_tok->global_auth_tok, &global_auth_tok->global_auth_tok,
global_auth_tok->sig))) { global_auth_tok->sig);
if (rc) {
printk(KERN_ERR "Could not find valid key in user " printk(KERN_ERR "Could not find valid key in user "
"session keyring for sig specified in mount " "session keyring for sig specified in mount "
"option: [%s]\n", global_auth_tok->sig); "option: [%s]\n", global_auth_tok->sig);
...@@ -355,9 +356,10 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options) ...@@ -355,9 +356,10 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options)
if (!cipher_key_bytes_set) { if (!cipher_key_bytes_set) {
mount_crypt_stat->global_default_cipher_key_size = 0; mount_crypt_stat->global_default_cipher_key_size = 0;
} }
if ((rc = ecryptfs_add_new_key_tfm( rc = ecryptfs_add_new_key_tfm(
NULL, mount_crypt_stat->global_default_cipher_name, NULL, mount_crypt_stat->global_default_cipher_name,
mount_crypt_stat->global_default_cipher_key_size))) { mount_crypt_stat->global_default_cipher_key_size);
if (rc) {
printk(KERN_ERR "Error attempting to initialize cipher with " printk(KERN_ERR "Error attempting to initialize cipher with "
"name = [%s] and key size = [%td]; rc = [%d]\n", "name = [%s] and key size = [%td]; rc = [%d]\n",
mount_crypt_stat->global_default_cipher_name, mount_crypt_stat->global_default_cipher_name,
...@@ -365,7 +367,8 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options) ...@@ -365,7 +367,8 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options)
rc = -EINVAL; rc = -EINVAL;
goto out; goto out;
} }
if ((rc = ecryptfs_init_global_auth_toks(mount_crypt_stat))) { rc = ecryptfs_init_global_auth_toks(mount_crypt_stat);
if (rc) {
printk(KERN_WARNING "One or more global auth toks could not " printk(KERN_WARNING "One or more global auth toks could not "
"properly register; rc = [%d]\n", rc); "properly register; rc = [%d]\n", rc);
} }
...@@ -458,7 +461,8 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name) ...@@ -458,7 +461,8 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
sb->s_maxbytes = lower_root->d_sb->s_maxbytes; sb->s_maxbytes = lower_root->d_sb->s_maxbytes;
ecryptfs_set_dentry_lower(sb->s_root, lower_root); ecryptfs_set_dentry_lower(sb->s_root, lower_root);
ecryptfs_set_dentry_lower_mnt(sb->s_root, lower_mnt); ecryptfs_set_dentry_lower_mnt(sb->s_root, lower_mnt);
if ((rc = ecryptfs_interpose(lower_root, sb->s_root, sb, 0))) rc = ecryptfs_interpose(lower_root, sb->s_root, sb, 0);
if (rc)
goto out_free; goto out_free;
rc = 0; rc = 0;
goto out; goto out;
...@@ -765,7 +769,8 @@ static int do_sysfs_registration(void) ...@@ -765,7 +769,8 @@ static int do_sysfs_registration(void)
{ {
int rc; int rc;
if ((rc = subsystem_register(&ecryptfs_subsys))) { rc = subsystem_register(&ecryptfs_subsys);
if (rc) {
printk(KERN_ERR printk(KERN_ERR
"Unable to register ecryptfs sysfs subsystem\n"); "Unable to register ecryptfs sysfs subsystem\n");
goto out; goto out;
...@@ -796,7 +801,8 @@ static void do_sysfs_unregistration(void) ...@@ -796,7 +801,8 @@ static void do_sysfs_unregistration(void)
{ {
int rc; int rc;
if ((rc = ecryptfs_destroy_crypto())) { rc = ecryptfs_destroy_crypto();
if (rc) {
printk(KERN_ERR "Failure whilst attempting to destroy crypto; " printk(KERN_ERR "Failure whilst attempting to destroy crypto; "
"rc = [%d]\n", rc); "rc = [%d]\n", rc);
} }
......
...@@ -419,8 +419,9 @@ int ecryptfs_init_messaging(unsigned int transport) ...@@ -419,8 +419,9 @@ int ecryptfs_init_messaging(unsigned int transport)
} }
mutex_init(&ecryptfs_daemon_id_hash_mux); mutex_init(&ecryptfs_daemon_id_hash_mux);
mutex_lock(&ecryptfs_daemon_id_hash_mux); mutex_lock(&ecryptfs_daemon_id_hash_mux);
ecryptfs_hash_buckets = 0; ecryptfs_hash_buckets = 1;
while (ecryptfs_number_of_users >> ++ecryptfs_hash_buckets); while (ecryptfs_number_of_users >> ecryptfs_hash_buckets)
ecryptfs_hash_buckets++;
ecryptfs_daemon_id_hash = kmalloc(sizeof(struct hlist_head) ecryptfs_daemon_id_hash = kmalloc(sizeof(struct hlist_head)
* ecryptfs_hash_buckets, GFP_KERNEL); * ecryptfs_hash_buckets, GFP_KERNEL);
if (!ecryptfs_daemon_id_hash) { if (!ecryptfs_daemon_id_hash) {
......
...@@ -762,8 +762,9 @@ ecryptfs_write_zeros(struct file *file, pgoff_t index, int start, int num_zeros) ...@@ -762,8 +762,9 @@ ecryptfs_write_zeros(struct file *file, pgoff_t index, int start, int num_zeros)
rc = PTR_ERR(tmp_page); rc = PTR_ERR(tmp_page);
goto out; goto out;
} }
if ((rc = ecryptfs_prepare_write_no_truncate(file, tmp_page, start, rc = ecryptfs_prepare_write_no_truncate(file, tmp_page, start,
(start + num_zeros)))) { (start + num_zeros));
if (rc) {
ecryptfs_printk(KERN_ERR, "Error preparing to write zero's " ecryptfs_printk(KERN_ERR, "Error preparing to write zero's "
"to page at index [0x%.16x]\n", "to page at index [0x%.16x]\n",
index); index);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment