aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs
diff options
context:
space:
mode:
authorMichael Halcrow <mhalcrow@us.ibm.com>2007-10-16 04:28:06 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:12 -0400
commit5dda6992a3138f3839dcaecbcd2fbea4dd514c7c (patch)
treec9ca012364edc18a2baed74721052b7da9d39f53 /fs/ecryptfs
parent45eaab79678b9e27e08f0cf250eb2df9d6a48df0 (diff)
eCryptfs: remove assignments in if-statements
Remove assignments in if-statements. Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r--fs/ecryptfs/crypto.c17
-rw-r--r--fs/ecryptfs/file.c8
-rw-r--r--fs/ecryptfs/inode.c35
-rw-r--r--fs/ecryptfs/keystore.c55
-rw-r--r--fs/ecryptfs/main.c28
-rw-r--r--fs/ecryptfs/messaging.c5
-rw-r--r--fs/ecryptfs/mmap.c5
7 files changed, 89 insertions, 64 deletions
diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
index 9127b809044d..e3d2118fafad 100644
--- a/fs/ecryptfs/crypto.c
+++ b/fs/ecryptfs/crypto.c
@@ -1277,8 +1277,8 @@ static int ecryptfs_read_header_region(char *data, struct dentry *dentry,
1277 mm_segment_t oldfs; 1277 mm_segment_t oldfs;
1278 int rc; 1278 int rc;
1279 1279
1280 if ((rc = ecryptfs_open_lower_file(&lower_file, dentry, mnt, 1280 rc = ecryptfs_open_lower_file(&lower_file, dentry, mnt, O_RDONLY);
1281 O_RDONLY))) { 1281 if (rc) {
1282 printk(KERN_ERR 1282 printk(KERN_ERR
1283 "Error opening lower_file to read header region\n"); 1283 "Error opening lower_file to read header region\n");
1284 goto out; 1284 goto out;
@@ -1289,7 +1289,8 @@ static int ecryptfs_read_header_region(char *data, struct dentry *dentry,
1289 rc = lower_file->f_op->read(lower_file, (char __user *)data, 1289 rc = lower_file->f_op->read(lower_file, (char __user *)data,
1290 ECRYPTFS_DEFAULT_EXTENT_SIZE, &lower_file->f_pos); 1290 ECRYPTFS_DEFAULT_EXTENT_SIZE, &lower_file->f_pos);
1291 set_fs(oldfs); 1291 set_fs(oldfs);
1292 if ((rc = ecryptfs_close_lower_file(lower_file))) { 1292 rc = ecryptfs_close_lower_file(lower_file);
1293 if (rc) {
1293 printk(KERN_ERR "Error closing lower_file\n"); 1294 printk(KERN_ERR "Error closing lower_file\n");
1294 goto out; 1295 goto out;
1295 } 1296 }
@@ -1951,9 +1952,10 @@ ecryptfs_add_new_key_tfm(struct ecryptfs_key_tfm **key_tfm, char *cipher_name,
1951 strncpy(tmp_tfm->cipher_name, cipher_name, 1952 strncpy(tmp_tfm->cipher_name, cipher_name,
1952 ECRYPTFS_MAX_CIPHER_NAME_SIZE); 1953 ECRYPTFS_MAX_CIPHER_NAME_SIZE);
1953 tmp_tfm->key_size = key_size; 1954 tmp_tfm->key_size = key_size;
1954 if ((rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm, 1955 rc = ecryptfs_process_key_cipher(&tmp_tfm->key_tfm,
1955 tmp_tfm->cipher_name, 1956 tmp_tfm->cipher_name,
1956 &tmp_tfm->key_size))) { 1957 &tmp_tfm->key_size);
1958 if (rc) {
1957 printk(KERN_ERR "Error attempting to initialize key TFM " 1959 printk(KERN_ERR "Error attempting to initialize key TFM "
1958 "cipher with name = [%s]; rc = [%d]\n", 1960 "cipher with name = [%s]; rc = [%d]\n",
1959 tmp_tfm->cipher_name, rc); 1961 tmp_tfm->cipher_name, rc);
@@ -1988,7 +1990,8 @@ int ecryptfs_get_tfm_and_mutex_for_cipher_name(struct crypto_blkcipher **tfm,
1988 } 1990 }
1989 } 1991 }
1990 mutex_unlock(&key_tfm_list_mutex); 1992 mutex_unlock(&key_tfm_list_mutex);
1991 if ((rc = ecryptfs_add_new_key_tfm(&key_tfm, cipher_name, 0))) { 1993 rc = ecryptfs_add_new_key_tfm(&key_tfm, cipher_name, 0);
1994 if (rc) {
1992 printk(KERN_ERR "Error adding new key_tfm to list; rc = [%d]\n", 1995 printk(KERN_ERR "Error adding new key_tfm to list; rc = [%d]\n",
1993 rc); 1996 rc);
1994 goto out; 1997 goto out;
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index 12ba7e3a69f9..59c846d29a8e 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -230,8 +230,9 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
230 lower_flags &= ~O_APPEND; 230 lower_flags &= ~O_APPEND;
231 lower_mnt = ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry); 231 lower_mnt = ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry);
232 /* Corresponding fput() in ecryptfs_release() */ 232 /* Corresponding fput() in ecryptfs_release() */
233 if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt, 233 rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt,
234 lower_flags))) { 234 lower_flags);
235 if (rc) {
235 ecryptfs_printk(KERN_ERR, "Error opening lower file\n"); 236 ecryptfs_printk(KERN_ERR, "Error opening lower file\n");
236 goto out_puts; 237 goto out_puts;
237 } 238 }
@@ -300,7 +301,8 @@ static int ecryptfs_release(struct inode *inode, struct file *file)
300 struct inode *lower_inode = ecryptfs_inode_to_lower(inode); 301 struct inode *lower_inode = ecryptfs_inode_to_lower(inode);
301 int rc; 302 int rc;
302 303
303 if ((rc = ecryptfs_close_lower_file(lower_file))) { 304 rc = ecryptfs_close_lower_file(lower_file);
305 if (rc) {
304 printk(KERN_ERR "Error closing lower_file\n"); 306 printk(KERN_ERR "Error closing lower_file\n");
305 goto out; 307 goto out;
306 } 308 }
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index abac91c58bfb..d70f5994ba51 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -202,8 +202,9 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry)
202 lower_flags = ((O_CREAT | O_TRUNC) & O_ACCMODE) | O_RDWR; 202 lower_flags = ((O_CREAT | O_TRUNC) & O_ACCMODE) | O_RDWR;
203 lower_mnt = ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry); 203 lower_mnt = ecryptfs_dentry_to_lower_mnt(ecryptfs_dentry);
204 /* Corresponding fput() at end of this function */ 204 /* Corresponding fput() at end of this function */
205 if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt, 205 rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt,
206 lower_flags))) { 206 lower_flags);
207 if (rc) {
207 ecryptfs_printk(KERN_ERR, 208 ecryptfs_printk(KERN_ERR,
208 "Error opening dentry; rc = [%i]\n", rc); 209 "Error opening dentry; rc = [%i]\n", rc);
209 goto out; 210 goto out;
@@ -229,7 +230,8 @@ static int ecryptfs_initialize_file(struct dentry *ecryptfs_dentry)
229 } 230 }
230 rc = grow_file(ecryptfs_dentry, lower_file, inode, lower_inode); 231 rc = grow_file(ecryptfs_dentry, lower_file, inode, lower_inode);
231out_fput: 232out_fput:
232 if ((rc = ecryptfs_close_lower_file(lower_file))) 233 rc = ecryptfs_close_lower_file(lower_file);
234 if (rc)
233 printk(KERN_ERR "Error closing lower_file\n"); 235 printk(KERN_ERR "Error closing lower_file\n");
234out: 236out:
235 return rc; 237 return rc;
@@ -779,8 +781,9 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
779 lower_dentry = ecryptfs_dentry_to_lower(dentry); 781 lower_dentry = ecryptfs_dentry_to_lower(dentry);
780 /* This dget & mntget is released through fput at out_fput: */ 782 /* This dget & mntget is released through fput at out_fput: */
781 lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); 783 lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
782 if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt, 784 rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, lower_mnt,
783 O_RDWR))) { 785 O_RDWR);
786 if (rc) {
784 ecryptfs_printk(KERN_ERR, 787 ecryptfs_printk(KERN_ERR,
785 "Error opening dentry; rc = [%i]\n", rc); 788 "Error opening dentry; rc = [%i]\n", rc);
786 goto out_free; 789 goto out_free;
@@ -813,11 +816,12 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
813 end_pos_in_page = ((new_length - 1) & ~PAGE_CACHE_MASK); 816 end_pos_in_page = ((new_length - 1) & ~PAGE_CACHE_MASK);
814 } 817 }
815 if (end_pos_in_page != (PAGE_CACHE_SIZE - 1)) { 818 if (end_pos_in_page != (PAGE_CACHE_SIZE - 1)) {
816 if ((rc = ecryptfs_write_zeros(&fake_ecryptfs_file, 819 rc = ecryptfs_write_zeros(&fake_ecryptfs_file,
817 index, 820 index,
818 (end_pos_in_page + 1), 821 (end_pos_in_page + 1),
819 ((PAGE_CACHE_SIZE - 1) 822 ((PAGE_CACHE_SIZE - 1)
820 - end_pos_in_page)))) { 823 - end_pos_in_page));
824 if (rc) {
821 printk(KERN_ERR "Error attempting to zero out " 825 printk(KERN_ERR "Error attempting to zero out "
822 "the remainder of the end page on " 826 "the remainder of the end page on "
823 "reducing truncate; rc = [%d]\n", rc); 827 "reducing truncate; rc = [%d]\n", rc);
@@ -849,7 +853,8 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
849 = CURRENT_TIME; 853 = CURRENT_TIME;
850 mark_inode_dirty_sync(inode); 854 mark_inode_dirty_sync(inode);
851out_fput: 855out_fput:
852 if ((rc = ecryptfs_close_lower_file(lower_file))) 856 rc = ecryptfs_close_lower_file(lower_file);
857 if (rc)
853 printk(KERN_ERR "Error closing lower_file\n"); 858 printk(KERN_ERR "Error closing lower_file\n");
854out_free: 859out_free:
855 if (ecryptfs_file_to_private(&fake_ecryptfs_file)) 860 if (ecryptfs_file_to_private(&fake_ecryptfs_file))
@@ -917,8 +922,9 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
917 922
918 lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); 923 lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
919 lower_flags = O_RDONLY; 924 lower_flags = O_RDONLY;
920 if ((rc = ecryptfs_open_lower_file(&lower_file, lower_dentry, 925 rc = ecryptfs_open_lower_file(&lower_file, lower_dentry,
921 lower_mnt, lower_flags))) { 926 lower_mnt, lower_flags);
927 if (rc) {
922 printk(KERN_ERR 928 printk(KERN_ERR
923 "Error opening lower file; rc = [%d]\n", rc); 929 "Error opening lower file; rc = [%d]\n", rc);
924 mutex_unlock(&crypt_stat->cs_mutex); 930 mutex_unlock(&crypt_stat->cs_mutex);
@@ -926,7 +932,8 @@ static int ecryptfs_setattr(struct dentry *dentry, struct iattr *ia)
926 } 932 }
927 mount_crypt_stat = &ecryptfs_superblock_to_private( 933 mount_crypt_stat = &ecryptfs_superblock_to_private(
928 dentry->d_sb)->mount_crypt_stat; 934 dentry->d_sb)->mount_crypt_stat;
929 if ((rc = ecryptfs_read_metadata(dentry, lower_file))) { 935 rc = ecryptfs_read_metadata(dentry, lower_file);
936 if (rc) {
930 if (!(mount_crypt_stat->flags 937 if (!(mount_crypt_stat->flags
931 & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) { 938 & ECRYPTFS_PLAINTEXT_PASSTHROUGH_ENABLED)) {
932 rc = -EIO; 939 rc = -EIO;
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index 09e2340ab783..89d9710dd63d 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -436,7 +436,8 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
436 size_t netlink_message_length; 436 size_t netlink_message_length;
437 int rc; 437 int rc;
438 438
439 if ((rc = ecryptfs_get_auth_tok_sig(&auth_tok_sig, auth_tok))) { 439 rc = ecryptfs_get_auth_tok_sig(&auth_tok_sig, auth_tok);
440 if (rc) {
440 printk(KERN_ERR "Unrecognized auth tok type: [%d]\n", 441 printk(KERN_ERR "Unrecognized auth tok type: [%d]\n",
441 auth_tok->token_type); 442 auth_tok->token_type);
442 goto out; 443 goto out;
@@ -569,8 +570,9 @@ parse_tag_1_packet(struct ecryptfs_crypt_stat *crypt_stat,
569 goto out; 570 goto out;
570 } 571 }
571 (*new_auth_tok) = &auth_tok_list_item->auth_tok; 572 (*new_auth_tok) = &auth_tok_list_item->auth_tok;
572 if ((rc = parse_packet_length(&data[(*packet_size)], &body_size, 573 rc = parse_packet_length(&data[(*packet_size)], &body_size,
573 &length_size))) { 574 &length_size);
575 if (rc) {
574 printk(KERN_WARNING "Error parsing packet length; " 576 printk(KERN_WARNING "Error parsing packet length; "
575 "rc = [%d]\n", rc); 577 "rc = [%d]\n", rc);
576 goto out_free; 578 goto out_free;
@@ -702,8 +704,9 @@ parse_tag_3_packet(struct ecryptfs_crypt_stat *crypt_stat,
702 goto out; 704 goto out;
703 } 705 }
704 (*new_auth_tok) = &auth_tok_list_item->auth_tok; 706 (*new_auth_tok) = &auth_tok_list_item->auth_tok;
705 if ((rc = parse_packet_length(&data[(*packet_size)], &body_size, 707 rc = parse_packet_length(&data[(*packet_size)], &body_size,
706 &length_size))) { 708 &length_size);
709 if (rc) {
707 printk(KERN_WARNING "Error parsing packet length; rc = [%d]\n", 710 printk(KERN_WARNING "Error parsing packet length; rc = [%d]\n",
708 rc); 711 rc);
709 goto out_free; 712 goto out_free;
@@ -849,8 +852,9 @@ parse_tag_11_packet(unsigned char *data, unsigned char *contents,
849 rc = -EINVAL; 852 rc = -EINVAL;
850 goto out; 853 goto out;
851 } 854 }
852 if ((rc = parse_packet_length(&data[(*packet_size)], &body_size, 855 rc = parse_packet_length(&data[(*packet_size)], &body_size,
853 &length_size))) { 856 &length_size);
857 if (rc) {
854 printk(KERN_WARNING "Invalid tag 11 packet format\n"); 858 printk(KERN_WARNING "Invalid tag 11 packet format\n");
855 goto out; 859 goto out;
856 } 860 }
@@ -1052,9 +1056,10 @@ decrypt_passphrase_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
1052 crypt_stat->cipher, rc); 1056 crypt_stat->cipher, rc);
1053 goto out; 1057 goto out;
1054 } 1058 }
1055 if ((rc = virt_to_scatterlist(auth_tok->session_key.encrypted_key, 1059 rc = virt_to_scatterlist(auth_tok->session_key.encrypted_key,
1056 auth_tok->session_key.encrypted_key_size, 1060 auth_tok->session_key.encrypted_key_size,
1057 &src_sg, 1)) != 1) { 1061 &src_sg, 1);
1062 if (rc != 1) {
1058 printk(KERN_ERR "Internal error whilst attempting to convert " 1063 printk(KERN_ERR "Internal error whilst attempting to convert "
1059 "auth_tok->session_key.encrypted_key to scatterlist; " 1064 "auth_tok->session_key.encrypted_key to scatterlist; "
1060 "expected rc = 1; got rc = [%d]. " 1065 "expected rc = 1; got rc = [%d]. "
@@ -1064,9 +1069,10 @@ decrypt_passphrase_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
1064 } 1069 }
1065 auth_tok->session_key.decrypted_key_size = 1070 auth_tok->session_key.decrypted_key_size =
1066 auth_tok->session_key.encrypted_key_size; 1071 auth_tok->session_key.encrypted_key_size;
1067 if ((rc = virt_to_scatterlist(auth_tok->session_key.decrypted_key, 1072 rc = virt_to_scatterlist(auth_tok->session_key.decrypted_key,
1068 auth_tok->session_key.decrypted_key_size, 1073 auth_tok->session_key.decrypted_key_size,
1069 &dst_sg, 1)) != 1) { 1074 &dst_sg, 1);
1075 if (rc != 1) {
1070 printk(KERN_ERR "Internal error whilst attempting to convert " 1076 printk(KERN_ERR "Internal error whilst attempting to convert "
1071 "auth_tok->session_key.decrypted_key to scatterlist; " 1077 "auth_tok->session_key.decrypted_key to scatterlist; "
1072 "expected rc = 1; got rc = [%d]\n", rc); 1078 "expected rc = 1; got rc = [%d]\n", rc);
@@ -1236,18 +1242,17 @@ find_next_matching_auth_tok:
1236 "Considering cadidate auth tok:\n"); 1242 "Considering cadidate auth tok:\n");
1237 ecryptfs_dump_auth_tok(candidate_auth_tok); 1243 ecryptfs_dump_auth_tok(candidate_auth_tok);
1238 } 1244 }
1239 if ((rc = ecryptfs_get_auth_tok_sig(&candidate_auth_tok_sig, 1245 rc = ecryptfs_get_auth_tok_sig(&candidate_auth_tok_sig,
1240 candidate_auth_tok))) { 1246 candidate_auth_tok);
1247 if (rc) {
1241 printk(KERN_ERR 1248 printk(KERN_ERR
1242 "Unrecognized candidate auth tok type: [%d]\n", 1249 "Unrecognized candidate auth tok type: [%d]\n",
1243 candidate_auth_tok->token_type); 1250 candidate_auth_tok->token_type);
1244 rc = -EINVAL; 1251 rc = -EINVAL;
1245 goto out_wipe_list; 1252 goto out_wipe_list;
1246 } 1253 }
1247 if ((rc = ecryptfs_find_auth_tok_for_sig( 1254 ecryptfs_find_auth_tok_for_sig(&matching_auth_tok, crypt_stat,
1248 &matching_auth_tok, crypt_stat, 1255 candidate_auth_tok_sig);
1249 candidate_auth_tok_sig)))
1250 rc = 0;
1251 if (matching_auth_tok) { 1256 if (matching_auth_tok) {
1252 found_auth_tok = 1; 1257 found_auth_tok = 1;
1253 goto found_matching_auth_tok; 1258 goto found_matching_auth_tok;
@@ -1605,9 +1610,9 @@ write_tag_3_packet(char *dest, size_t *remaining_bytes,
1605 ecryptfs_printk(KERN_DEBUG, "Session key encryption key:\n"); 1610 ecryptfs_printk(KERN_DEBUG, "Session key encryption key:\n");
1606 ecryptfs_dump_hex(session_key_encryption_key, 16); 1611 ecryptfs_dump_hex(session_key_encryption_key, 16);
1607 } 1612 }
1608 if ((rc = virt_to_scatterlist(crypt_stat->key, 1613 rc = virt_to_scatterlist(crypt_stat->key, key_rec->enc_key_size,
1609 key_rec->enc_key_size, &src_sg, 1)) 1614 &src_sg, 1);
1610 != 1) { 1615 if (rc != 1) {
1611 ecryptfs_printk(KERN_ERR, "Error generating scatterlist " 1616 ecryptfs_printk(KERN_ERR, "Error generating scatterlist "
1612 "for crypt_stat session key; expected rc = 1; " 1617 "for crypt_stat session key; expected rc = 1; "
1613 "got rc = [%d]. key_rec->enc_key_size = [%d]\n", 1618 "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 rc = -ENOMEM; 1620 rc = -ENOMEM;
1616 goto out; 1621 goto out;
1617 } 1622 }
1618 if ((rc = virt_to_scatterlist(key_rec->enc_key, 1623 rc = virt_to_scatterlist(key_rec->enc_key, key_rec->enc_key_size,
1619 key_rec->enc_key_size, &dst_sg, 1)) 1624 &dst_sg, 1);
1620 != 1) { 1625 if (rc != 1) {
1621 ecryptfs_printk(KERN_ERR, "Error generating scatterlist " 1626 ecryptfs_printk(KERN_ERR, "Error generating scatterlist "
1622 "for crypt_stat encrypted session key; " 1627 "for crypt_stat encrypted session key; "
1623 "expected rc = 1; got rc = [%d]. " 1628 "expected rc = 1; got rc = [%d]. "
diff --git a/fs/ecryptfs/main.c b/fs/ecryptfs/main.c
index d4f00bbbcdc5..00686f1c5997 100644
--- a/fs/ecryptfs/main.c
+++ b/fs/ecryptfs/main.c
@@ -188,10 +188,11 @@ static int ecryptfs_init_global_auth_toks(
188 list_for_each_entry(global_auth_tok, 188 list_for_each_entry(global_auth_tok,
189 &mount_crypt_stat->global_auth_tok_list, 189 &mount_crypt_stat->global_auth_tok_list,
190 mount_crypt_stat_list) { 190 mount_crypt_stat_list) {
191 if ((rc = ecryptfs_keyring_auth_tok_for_sig( 191 rc = ecryptfs_keyring_auth_tok_for_sig(
192 &global_auth_tok->global_auth_tok_key, 192 &global_auth_tok->global_auth_tok_key,
193 &global_auth_tok->global_auth_tok, 193 &global_auth_tok->global_auth_tok,
194 global_auth_tok->sig))) { 194 global_auth_tok->sig);
195 if (rc) {
195 printk(KERN_ERR "Could not find valid key in user " 196 printk(KERN_ERR "Could not find valid key in user "
196 "session keyring for sig specified in mount " 197 "session keyring for sig specified in mount "
197 "option: [%s]\n", global_auth_tok->sig); 198 "option: [%s]\n", global_auth_tok->sig);
@@ -355,9 +356,10 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options)
355 if (!cipher_key_bytes_set) { 356 if (!cipher_key_bytes_set) {
356 mount_crypt_stat->global_default_cipher_key_size = 0; 357 mount_crypt_stat->global_default_cipher_key_size = 0;
357 } 358 }
358 if ((rc = ecryptfs_add_new_key_tfm( 359 rc = ecryptfs_add_new_key_tfm(
359 NULL, mount_crypt_stat->global_default_cipher_name, 360 NULL, mount_crypt_stat->global_default_cipher_name,
360 mount_crypt_stat->global_default_cipher_key_size))) { 361 mount_crypt_stat->global_default_cipher_key_size);
362 if (rc) {
361 printk(KERN_ERR "Error attempting to initialize cipher with " 363 printk(KERN_ERR "Error attempting to initialize cipher with "
362 "name = [%s] and key size = [%td]; rc = [%d]\n", 364 "name = [%s] and key size = [%td]; rc = [%d]\n",
363 mount_crypt_stat->global_default_cipher_name, 365 mount_crypt_stat->global_default_cipher_name,
@@ -365,7 +367,8 @@ static int ecryptfs_parse_options(struct super_block *sb, char *options)
365 rc = -EINVAL; 367 rc = -EINVAL;
366 goto out; 368 goto out;
367 } 369 }
368 if ((rc = ecryptfs_init_global_auth_toks(mount_crypt_stat))) { 370 rc = ecryptfs_init_global_auth_toks(mount_crypt_stat);
371 if (rc) {
369 printk(KERN_WARNING "One or more global auth toks could not " 372 printk(KERN_WARNING "One or more global auth toks could not "
370 "properly register; rc = [%d]\n", rc); 373 "properly register; rc = [%d]\n", rc);
371 } 374 }
@@ -458,7 +461,8 @@ static int ecryptfs_read_super(struct super_block *sb, const char *dev_name)
458 sb->s_maxbytes = lower_root->d_sb->s_maxbytes; 461 sb->s_maxbytes = lower_root->d_sb->s_maxbytes;
459 ecryptfs_set_dentry_lower(sb->s_root, lower_root); 462 ecryptfs_set_dentry_lower(sb->s_root, lower_root);
460 ecryptfs_set_dentry_lower_mnt(sb->s_root, lower_mnt); 463 ecryptfs_set_dentry_lower_mnt(sb->s_root, lower_mnt);
461 if ((rc = ecryptfs_interpose(lower_root, sb->s_root, sb, 0))) 464 rc = ecryptfs_interpose(lower_root, sb->s_root, sb, 0);
465 if (rc)
462 goto out_free; 466 goto out_free;
463 rc = 0; 467 rc = 0;
464 goto out; 468 goto out;
@@ -765,7 +769,8 @@ static int do_sysfs_registration(void)
765{ 769{
766 int rc; 770 int rc;
767 771
768 if ((rc = subsystem_register(&ecryptfs_subsys))) { 772 rc = subsystem_register(&ecryptfs_subsys);
773 if (rc) {
769 printk(KERN_ERR 774 printk(KERN_ERR
770 "Unable to register ecryptfs sysfs subsystem\n"); 775 "Unable to register ecryptfs sysfs subsystem\n");
771 goto out; 776 goto out;
@@ -796,7 +801,8 @@ static void do_sysfs_unregistration(void)
796{ 801{
797 int rc; 802 int rc;
798 803
799 if ((rc = ecryptfs_destroy_crypto())) { 804 rc = ecryptfs_destroy_crypto();
805 if (rc) {
800 printk(KERN_ERR "Failure whilst attempting to destroy crypto; " 806 printk(KERN_ERR "Failure whilst attempting to destroy crypto; "
801 "rc = [%d]\n", rc); 807 "rc = [%d]\n", rc);
802 } 808 }
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c
index a9d87c47f72d..a96d341d154d 100644
--- a/fs/ecryptfs/messaging.c
+++ b/fs/ecryptfs/messaging.c
@@ -419,8 +419,9 @@ int ecryptfs_init_messaging(unsigned int transport)
419 } 419 }
420 mutex_init(&ecryptfs_daemon_id_hash_mux); 420 mutex_init(&ecryptfs_daemon_id_hash_mux);
421 mutex_lock(&ecryptfs_daemon_id_hash_mux); 421 mutex_lock(&ecryptfs_daemon_id_hash_mux);
422 ecryptfs_hash_buckets = 0; 422 ecryptfs_hash_buckets = 1;
423 while (ecryptfs_number_of_users >> ++ecryptfs_hash_buckets); 423 while (ecryptfs_number_of_users >> ecryptfs_hash_buckets)
424 ecryptfs_hash_buckets++;
424 ecryptfs_daemon_id_hash = kmalloc(sizeof(struct hlist_head) 425 ecryptfs_daemon_id_hash = kmalloc(sizeof(struct hlist_head)
425 * ecryptfs_hash_buckets, GFP_KERNEL); 426 * ecryptfs_hash_buckets, GFP_KERNEL);
426 if (!ecryptfs_daemon_id_hash) { 427 if (!ecryptfs_daemon_id_hash) {
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index 89dbbbbcce07..307f7ee77420 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -762,8 +762,9 @@ ecryptfs_write_zeros(struct file *file, pgoff_t index, int start, int num_zeros)
762 rc = PTR_ERR(tmp_page); 762 rc = PTR_ERR(tmp_page);
763 goto out; 763 goto out;
764 } 764 }
765 if ((rc = ecryptfs_prepare_write_no_truncate(file, tmp_page, start, 765 rc = ecryptfs_prepare_write_no_truncate(file, tmp_page, start,
766 (start + num_zeros)))) { 766 (start + num_zeros));
767 if (rc) {
767 ecryptfs_printk(KERN_ERR, "Error preparing to write zero's " 768 ecryptfs_printk(KERN_ERR, "Error preparing to write zero's "
768 "to page at index [0x%.16x]\n", 769 "to page at index [0x%.16x]\n",
769 index); 770 index);