OSDN Git Service

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 09:27:20 +0000 (02:27 -0700)
commit82bec888567bbe1143ae2173b2ef442070ecbe4a
treee98ea802ee3541f7e79fe7e20cd49bbb7b1b3b04
parent168a90782888affff92b4a4fe950c9e5afca7179
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