--- zzzz-none-000/linux-2.6.32.60/fs/ecryptfs/keystore.c 2012-10-07 21:41:24.000000000 +0000 +++ ur8-7270-606/linux-2.6.32.60/fs/ecryptfs/keystore.c 2013-02-12 10:51:26.000000000 +0000 @@ -481,8 +481,8 @@ struct mutex *tfm_mutex; char *block_aligned_filename; struct ecryptfs_auth_tok *auth_tok; - struct scatterlist src_sg[2]; - struct scatterlist dst_sg[2]; + struct scatterlist src_sg; + struct scatterlist dst_sg; struct blkcipher_desc desc; char iv[ECRYPTFS_MAX_IV_BYTES]; char hash[ECRYPTFS_TAG_70_DIGEST_SIZE]; @@ -695,21 +695,23 @@ memcpy(&s->block_aligned_filename[s->num_rand_bytes], filename, filename_size); rc = virt_to_scatterlist(s->block_aligned_filename, - s->block_aligned_filename_size, s->src_sg, 2); - if (rc < 1) { + s->block_aligned_filename_size, &s->src_sg, 1); + if (rc != 1) { printk(KERN_ERR "%s: Internal error whilst attempting to " - "convert filename memory to scatterlist; rc = [%d]. " + "convert filename memory to scatterlist; " + "expected rc = 1; got rc = [%d]. " "block_aligned_filename_size = [%zd]\n", __func__, rc, s->block_aligned_filename_size); goto out_release_free_unlock; } rc = virt_to_scatterlist(&dest[s->i], s->block_aligned_filename_size, - s->dst_sg, 2); - if (rc < 1) { + &s->dst_sg, 1); + if (rc != 1) { printk(KERN_ERR "%s: Internal error whilst attempting to " "convert encrypted filename memory to scatterlist; " - "rc = [%d]. block_aligned_filename_size = [%zd]\n", - __func__, rc, s->block_aligned_filename_size); + "expected rc = 1; got rc = [%d]. " + "block_aligned_filename_size = [%zd]\n", __func__, rc, + s->block_aligned_filename_size); goto out_release_free_unlock; } /* The characters in the first block effectively do the job @@ -732,7 +734,7 @@ mount_crypt_stat->global_default_fn_cipher_key_bytes); goto out_release_free_unlock; } - rc = crypto_blkcipher_encrypt_iv(&s->desc, s->dst_sg, s->src_sg, + rc = crypto_blkcipher_encrypt_iv(&s->desc, &s->dst_sg, &s->src_sg, s->block_aligned_filename_size); if (rc) { printk(KERN_ERR "%s: Error attempting to encrypt filename; " @@ -764,8 +766,8 @@ struct mutex *tfm_mutex; char *decrypted_filename; struct ecryptfs_auth_tok *auth_tok; - struct scatterlist src_sg[2]; - struct scatterlist dst_sg[2]; + struct scatterlist src_sg; + struct scatterlist dst_sg; struct blkcipher_desc desc; char fnek_sig_hex[ECRYPTFS_SIG_SIZE_HEX + 1]; char iv[ECRYPTFS_MAX_IV_BYTES]; @@ -870,12 +872,13 @@ } mutex_lock(s->tfm_mutex); rc = virt_to_scatterlist(&data[(*packet_size)], - s->block_aligned_filename_size, s->src_sg, 2); - if (rc < 1) { + s->block_aligned_filename_size, &s->src_sg, 1); + if (rc != 1) { printk(KERN_ERR "%s: Internal error whilst attempting to " "convert encrypted filename memory to scatterlist; " - "rc = [%d]. block_aligned_filename_size = [%zd]\n", - __func__, rc, s->block_aligned_filename_size); + "expected rc = 1; got rc = [%d]. " + "block_aligned_filename_size = [%zd]\n", __func__, rc, + s->block_aligned_filename_size); goto out_unlock; } (*packet_size) += s->block_aligned_filename_size; @@ -889,12 +892,13 @@ goto out_unlock; } rc = virt_to_scatterlist(s->decrypted_filename, - s->block_aligned_filename_size, s->dst_sg, 2); - if (rc < 1) { + s->block_aligned_filename_size, &s->dst_sg, 1); + if (rc != 1) { printk(KERN_ERR "%s: Internal error whilst attempting to " "convert decrypted filename memory to scatterlist; " - "rc = [%d]. block_aligned_filename_size = [%zd]\n", - __func__, rc, s->block_aligned_filename_size); + "expected rc = 1; got rc = [%d]. " + "block_aligned_filename_size = [%zd]\n", __func__, rc, + s->block_aligned_filename_size); goto out_free_unlock; } /* The characters in the first block effectively do the job of @@ -933,7 +937,7 @@ mount_crypt_stat->global_default_fn_cipher_key_bytes); goto out_free_unlock; } - rc = crypto_blkcipher_decrypt_iv(&s->desc, s->dst_sg, s->src_sg, + rc = crypto_blkcipher_decrypt_iv(&s->desc, &s->dst_sg, &s->src_sg, s->block_aligned_filename_size); if (rc) { printk(KERN_ERR "%s: Error attempting to decrypt filename; "