aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2017-05-22 21:14:06 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-06-23 19:59:08 -0400
commit27e47a6342e21b005a15a1f0afea0b6f179e0a71 (patch)
treecd7a921261cfc3fef680735ec00328927daacaff
parent3c2993b8c6143d8a5793746a54eba8f86f95240f (diff)
fscrypt: inline fscrypt_free_filename()
fscrypt_free_filename() only needs to do a kfree() of crypto_buf.name, which works well as an inline function. We can skip setting the various pointers to NULL, since no user cares about it (the name is always freed just before it goes out of scope). Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: David Gstir <david@sigma-star.at> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/crypto/fname.c9
-rw-r--r--include/linux/fscrypt_supp.h7
2 files changed, 6 insertions, 10 deletions
diff --git a/fs/crypto/fname.c b/fs/crypto/fname.c
index d1bb02b1ee58..ad9f814fdead 100644
--- a/fs/crypto/fname.c
+++ b/fs/crypto/fname.c
@@ -453,12 +453,3 @@ errout:
453 return ret; 453 return ret;
454} 454}
455EXPORT_SYMBOL(fscrypt_setup_filename); 455EXPORT_SYMBOL(fscrypt_setup_filename);
456
457void fscrypt_free_filename(struct fscrypt_name *fname)
458{
459 kfree(fname->crypto_buf.name);
460 fname->crypto_buf.name = NULL;
461 fname->usr_fname = NULL;
462 fname->disk_name.name = NULL;
463}
464EXPORT_SYMBOL(fscrypt_free_filename);
diff --git a/include/linux/fscrypt_supp.h b/include/linux/fscrypt_supp.h
index cd4e82c17304..32e2fcf13b01 100644
--- a/include/linux/fscrypt_supp.h
+++ b/include/linux/fscrypt_supp.h
@@ -47,7 +47,12 @@ extern void fscrypt_put_encryption_info(struct inode *, struct fscrypt_info *);
47/* fname.c */ 47/* fname.c */
48extern int fscrypt_setup_filename(struct inode *, const struct qstr *, 48extern int fscrypt_setup_filename(struct inode *, const struct qstr *,
49 int lookup, struct fscrypt_name *); 49 int lookup, struct fscrypt_name *);
50extern void fscrypt_free_filename(struct fscrypt_name *); 50
51static inline void fscrypt_free_filename(struct fscrypt_name *fname)
52{
53 kfree(fname->crypto_buf.name);
54}
55
51extern u32 fscrypt_fname_encrypted_size(const struct inode *, u32); 56extern u32 fscrypt_fname_encrypted_size(const struct inode *, u32);
52extern int fscrypt_fname_alloc_buffer(const struct inode *, u32, 57extern int fscrypt_fname_alloc_buffer(const struct inode *, u32,
53 struct fscrypt_str *); 58 struct fscrypt_str *);