]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - fs/crypto/policy.c
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
[mirror_ubuntu-artful-kernel.git] / fs / crypto / policy.c
index 210976e7a269ff0760cf81f6b1975632f9876862..ce07a86200f3344a7e10f24b0beecd8354e9fe21 100644 (file)
@@ -38,12 +38,8 @@ static int create_encryption_context_from_policy(struct inode *inode,
        memcpy(ctx.master_key_descriptor, policy->master_key_descriptor,
                                        FS_KEY_DESCRIPTOR_SIZE);
 
-       if (!fscrypt_valid_contents_enc_mode(
-                               policy->contents_encryption_mode))
-               return -EINVAL;
-
-       if (!fscrypt_valid_filenames_enc_mode(
-                               policy->filenames_encryption_mode))
+       if (!fscrypt_valid_enc_modes(policy->contents_encryption_mode,
+                                    policy->filenames_encryption_mode))
                return -EINVAL;
 
        if (policy->flags & ~FS_POLICY_FLAGS_VALID)
@@ -260,6 +256,7 @@ int fscrypt_inherit_context(struct inode *parent, struct inode *child,
        memcpy(ctx.master_key_descriptor, ci->ci_master_key,
               FS_KEY_DESCRIPTOR_SIZE);
        get_random_bytes(ctx.nonce, FS_KEY_DERIVATION_NONCE_SIZE);
+       BUILD_BUG_ON(sizeof(ctx) != FSCRYPT_SET_CONTEXT_MAX_SIZE);
        res = parent->i_sb->s_cop->set_context(child, &ctx,
                                                sizeof(ctx), fs_data);
        if (res)