From: Eric Biggers <ebiggers@kernel.org>
To: Florian Schmaus <flo@geekplace.eu>
Cc: linux-ext4@vger.kernel.org
Subject: Re: [PATCH 2/3] e4crypt: refactor set_policy a little
Date: Mon, 6 Jul 2020 15:04:20 -0700 [thread overview]
Message-ID: <20200706220420.GB827691@gmail.com> (raw)
In-Reply-To: <20200706194727.12979-2-flo@geekplace.eu>
On Mon, Jul 06, 2020 at 09:47:26PM +0200, Florian Schmaus wrote:
> Remove the superfluous 'salt' variable and simply use the functions
> parameter instead.
>
> Signed-off-by: Florian Schmaus <flo@geekplace.eu>
> ---
> misc/e4crypt.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/misc/e4crypt.c b/misc/e4crypt.c
> index c82c6f8f..23980073 100644
> --- a/misc/e4crypt.c
> +++ b/misc/e4crypt.c
> @@ -344,10 +344,9 @@ static void parse_salt(char *salt_str, int flags)
> add_salt(salt_buf, salt_len);
> }
>
> -static void set_policy(struct salt *set_salt, int pad,
> +static void set_policy(struct salt *salt, int pad,
> int argc, char *argv[], int path_start_index)
> {
> - struct salt *salt;
> struct ext4_encryption_policy policy;
> uuid_t uu;
> int fd;
> @@ -366,9 +365,7 @@ static void set_policy(struct salt *set_salt, int pad,
> perror(argv[x]);
> exit(1);
> }
> - if (set_salt)
> - salt = set_salt;
> - else {
> + if (!salt) {
> if (ioctl(fd, EXT4_IOC_GET_ENCRYPTION_PWSALT,
> &uu) < 0) {
> perror("EXT4_IOC_GET_ENCRYPTION_PWSALT");
This is wrong. If no salt was explicitly specified, then the salt returned by
EXT4_IOC_GET_ENCRYPTION_PWSALT for the directory should be used. There can be
multiple directories being processed. Your patch changes the behavior so that
the default salt of the first directory is also used for all later directories.
- Eric
next prev parent reply other threads:[~2020-07-06 22:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-06 19:47 [PATCH 1/3] e4crypt: if salt is explicitly provided to add_key, then use it Florian Schmaus
2020-07-06 19:47 ` [PATCH 2/3] e4crypt: refactor set_policy a little Florian Schmaus
2020-07-06 22:04 ` Eric Biggers [this message]
2020-07-06 19:47 ` [PATCH 3/3] Clarify in e4crypt man page that -S is an optional argument Florian Schmaus
2020-07-06 21:57 ` [PATCH 1/3] e4crypt: if salt is explicitly provided to add_key, then use it Eric Biggers
2020-07-07 8:36 ` Florian Schmaus
2020-07-07 21:40 ` Eric Biggers
2020-07-07 8:27 ` [PATCH v2] " Florian Schmaus
2020-07-07 21:47 ` Eric Biggers
2020-10-01 14:36 ` Theodore Y. Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200706220420.GB827691@gmail.com \
--to=ebiggers@kernel.org \
--cc=flo@geekplace.eu \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).