* [PATCH] fscrypt: inline fscrypt_free_filename()
@ 2017-05-23 1:14 Eric Biggers
2017-05-23 6:01 ` David Gstir
2017-06-24 0:02 ` Theodore Ts'o
0 siblings, 2 replies; 3+ messages in thread
From: Eric Biggers @ 2017-05-23 1:14 UTC (permalink / raw)
To: linux-fscrypt; +Cc: Theodore Y . Ts'o, Jaegeuk Kim, Eric Biggers
From: Eric Biggers <ebiggers@google.com>
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>
---
fs/crypto/fname.c | 9 ---------
include/linux/fscrypt_supp.h | 7 ++++++-
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 @@ int fscrypt_setup_filename(struct inode *dir, const struct qstr *iname,
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);
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 *);
/* 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 *);
--
2.13.0.219.gdb65acc882-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fscrypt: inline fscrypt_free_filename()
2017-05-23 1:14 [PATCH] fscrypt: inline fscrypt_free_filename() Eric Biggers
@ 2017-05-23 6:01 ` David Gstir
2017-06-24 0:02 ` Theodore Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: David Gstir @ 2017-05-23 6:01 UTC (permalink / raw)
To: Eric Biggers
Cc: linux-fscrypt, Theodore Y . Ts'o, Jaegeuk Kim, Eric Biggers
Hi Eric,
> On 23 May 2017, at 03:14, Eric Biggers <ebiggers3@gmail.com> wrote:
>
> From: Eric Biggers <ebiggers@google.com>
>
> 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>
> ---
> fs/crypto/fname.c | 9 ---------
> include/linux/fscrypt_supp.h | 7 ++++++-
> 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 @@ int fscrypt_setup_filename(struct inode *dir, const struct qstr *iname,
> 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);
> 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 *);
> /* 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 *);
> --
> 2.13.0.219.gdb65acc882-goog
LGTM.
Reviewed-by: David Gstir <david@sigma-star.at>
David
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] fscrypt: inline fscrypt_free_filename()
2017-05-23 1:14 [PATCH] fscrypt: inline fscrypt_free_filename() Eric Biggers
2017-05-23 6:01 ` David Gstir
@ 2017-06-24 0:02 ` Theodore Ts'o
1 sibling, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2017-06-24 0:02 UTC (permalink / raw)
To: Eric Biggers; +Cc: linux-fscrypt, Jaegeuk Kim, Eric Biggers
On Mon, May 22, 2017 at 06:14:06PM -0700, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> 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>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-24 0:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-23 1:14 [PATCH] fscrypt: inline fscrypt_free_filename() Eric Biggers
2017-05-23 6:01 ` David Gstir
2017-06-24 0:02 ` Theodore Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox