lkml.org 
[lkml]   [2016]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 15/26] ubifs: Implement encrypt/decrypt for all IO
From
Date
Eric,

On 21.10.2016 20:25, Eric Biggers wrote:
> On Fri, Oct 21, 2016 at 02:48:30PM +0200, Richard Weinberger wrote:
>> +
>> + if (ubifs_crypt_is_encrypted(inode)) {
>> + int clen = le16_to_cpu(dn->compr_size);
>> +
>> + if (clen <= 0 || clen > UBIFS_BLOCK_SIZE || clen > dlen)
>> + goto dump;
>> +
>> + ubifs_assert(dlen <= UBIFS_BLOCK_SIZE);
>> + err = fscrypt_decrypt_buffer(inode, &dn->data, &dn->data, dlen, block, GFP_NOFS);
>> + if (err) {
>> + ubifs_err(c, "fscrypt_decrypt_buffer failed: %i", err);
>> + return err;
>> + }
>> +
>> + ubifs_assert(clen <= dlen);
>> + dlen = clen;
>> + }
>> +
>
> There are several code blocks like this, calling either fscrypt_decrypt_buffer()
> or fscrypt_encrypt_buffer(), which seem to be mostly duplicated. Is it possible
> to refactor them into helper functions? There are also some lines well over 80
> characters.

Yes, that's already on my TODO.

Thanks,
//richard

\
 
 \ /
  Last update: 2016-10-24 09:04    [W:0.127 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site