fscrypt: define fscrypt_fname_alloc_buffer() to be for presented names
authorEric Biggers <ebiggers@google.com>
Fri, 12 Jan 2018 04:30:08 +0000 (23:30 -0500)
committerJaegeuk Kim <jaegeuk@kernel.org>
Sun, 8 Apr 2018 10:35:01 +0000 (03:35 -0700)
commit7919cba9230452d16dfa61e24f48a201964a859b
treed021aa5d9aabecde40e88cb8f691f27cafd405e2
parentaef0017f3b1a5a4fce71a63346a24271dbafb644
fscrypt: define fscrypt_fname_alloc_buffer() to be for presented names

Previously fscrypt_fname_alloc_buffer() was used to allocate buffers for
both presented (decrypted or encoded) and encrypted filenames.  That was
confusing, because it had to allocate the worst-case size for either,
e.g. including NUL-padding even when it was meaningless.

But now that fscrypt_setup_filename() no longer calls it, it is only
used in the ->get_link() and ->readdir() paths, which specifically want
a buffer for presented filenames.  Therefore, switch the behavior over
to allocating the buffer for presented filenames only.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/crypto/fname.c
include/linux/fscrypt_notsupp.h