add patch add-dummy-key-mount-option
[ext4-patch-queue.git] / fix-crypto-warnings
blob4328499d631a7b26d5e16b8d51ae4f04a48837d8
1 ext4 crypto: fix compile warnings
3 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
4 ---
5  fs/ext4/crypto.c | 19 ++++++++++---------
6  1 file changed, 10 insertions(+), 9 deletions(-)
8 diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c
9 index e892d68..0428608 100644
10 --- a/fs/ext4/crypto.c
11 +++ b/fs/ext4/crypto.c
12 @@ -27,6 +27,7 @@
13  #include <linux/random.h>
14  #include <linux/scatterlist.h>
15  #include <linux/spinlock_types.h>
16 +#include <linux/key.h>
18  #include "ext4.h"
19  #include "xattr.h"
20 @@ -35,10 +36,10 @@
22  /* Encryption added and removed here! (L: */
24 -mempool_t *ext4_bounce_page_pool = NULL;
25 +static mempool_t *ext4_bounce_page_pool = NULL;
27 -LIST_HEAD(ext4_free_crypto_ctxs);
28 -DEFINE_SPINLOCK(ext4_crypto_ctx_lock);
29 +static LIST_HEAD(ext4_free_crypto_ctxs);
30 +static DEFINE_SPINLOCK(ext4_crypto_ctx_lock);
32  /* TODO(mhalcrow): Remove for release */
33  atomic_t ext4_dbg_pages = ATOMIC_INIT(0);
34 @@ -87,7 +88,7 @@ void ext4_release_crypto_ctx(struct ext4_crypto_ctx *ctx)
35   * Return: An allocated and initialized encryption context on
36   * success. An error value or NULL otherwise.
37   */
38 -static struct ext4_crypto_ctx *ext4_alloc_and_init_crypto_ctx(u32 mask)
39 +static struct ext4_crypto_ctx *ext4_alloc_and_init_crypto_ctx(gfp_t mask)
40  {
41         struct ext4_crypto_ctx *ctx = kzalloc(sizeof(struct ext4_crypto_ctx),
42                                               mask);
43 @@ -373,8 +374,8 @@ static void ext4_prep_pages_for_write(struct page *ciphertext_page,
44   * Return: An allocated page with the encrypted content on
45   * success. Else, an error value or NULL.
46   */
47 -struct page *ext4_xts_encrypt(struct ext4_crypto_ctx *ctx,
48 -                             struct page *plaintext_page)
49 +static struct page *ext4_xts_encrypt(struct ext4_crypto_ctx *ctx,
50 +                                    struct page *plaintext_page)
51  {
52         struct page *ciphertext_page = ctx->bounce_page;
53         u8 xts_tweak[EXT4_XTS_TWEAK_SIZE];
54 @@ -493,7 +494,7 @@ struct page *ext4_encrypt(struct ext4_crypto_ctx *ctx,
55   *
56   * Return: Zero on success, non-zero otherwise.
57   */
58 -int ext4_xts_decrypt(struct ext4_crypto_ctx *ctx, struct page *page)
59 +static int ext4_xts_decrypt(struct ext4_crypto_ctx *ctx, struct page *page)
60  {
61         u8 xts_tweak[EXT4_XTS_TWEAK_SIZE];
62         struct ablkcipher_request *req = NULL;
63 @@ -607,7 +608,7 @@ static int ext4_get_wrapping_key_from_keyring(
64         if (WARN_ON_ONCE(create_key->datalen !=
65                          sizeof(struct ecryptfs_auth_tok))) {
66                 printk(KERN_ERR
67 -                      "%s: Got auth tok length [%d], expected [%ld]\n",
68 +                      "%s: Got auth tok length [%d], expected [%zd]\n",
69                        __func__, create_key->datalen,
70                        sizeof(struct ecryptfs_auth_tok));
71                 return -EINVAL;
72 @@ -706,7 +707,7 @@ static uint32_t ext4_validate_encryption_key_size(uint32_t mode, uint32_t size)
73  struct ext4_hmac_result {
74         struct completion completion;
75         int res;
76 -} ext4_hmac_result;
77 +};
79  /**
80   * ext4_hmac_complete() - Completion for async HMAC