fscrypt: inline fscrypt_free_filename()
authorEric Biggers <ebiggers@google.com>
Tue, 23 May 2017 01:14:06 +0000 (18:14 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 23 Jun 2017 23:59:08 +0000 (19:59 -0400)
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>
fs/crypto/fname.c
include/linux/fscrypt_supp.h

index d1bb02b1ee589ecd68876ff240bf57e756a70466..ad9f814fdead370eaa420a423139938687c3047b 100644 (file)
@@ -453,12 +453,3 @@ errout:
        return ret;
 }
 EXPORT_SYMBOL(fscrypt_setup_filename);
-
-void fscrypt_free_filename(struct fscrypt_name *fname)
-{
-       kfree(fname->crypto_buf.name);
-       fname->crypto_buf.name = NULL;
-       fname->usr_fname = NULL;
-       fname->disk_name.name = NULL;
-}
-EXPORT_SYMBOL(fscrypt_free_filename);
index cd4e82c17304ffbe97868b4aec146ca623ec2d78..32e2fcf13b015ed198381c06c750b84ada99cafd 100644 (file)
@@ -47,7 +47,12 @@ extern void fscrypt_put_encryption_info(struct inode *, struct fscrypt_info *);
 /* fname.c */
 extern int fscrypt_setup_filename(struct inode *, const struct qstr *,
                                int lookup, struct fscrypt_name *);
-extern void fscrypt_free_filename(struct fscrypt_name *);
+
+static inline void fscrypt_free_filename(struct fscrypt_name *fname)
+{
+       kfree(fname->crypto_buf.name);
+}
+
 extern u32 fscrypt_fname_encrypted_size(const struct inode *, u32);
 extern int fscrypt_fname_alloc_buffer(const struct inode *, u32,
                                struct fscrypt_str *);