lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed,  6 Nov 2019 11:14:50 +0100
From:   Lukas Czerner <lczerner@...hat.com>
To:     linux-ext4@...r.kernel.org
Cc:     Theodore Ts'o <tytso@....edu>, David Howells <dhowells@...hat.com>,
        Al Viro <viro@...iv.linux.org.uk>
Subject: [PATCH 10/17] ext4: clean up return values in handle_mount_opt()

Clean up return values in handle_mount_opt() and renabe to function to
ext4_parse_param()

Now we can use is in fs_context_operations as .parse_param.

Signed-off-by: Lukas Czerner <lczerner@...hat.com>
---
 fs/ext4/super.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 417a929cb0ab..dabb55bb999f 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -92,6 +92,7 @@ static int ext4_validate_options(struct fs_context *fc);
 static int ext4_check_opt_consistency(struct fs_context *fc,
 				      struct super_block *sb);
 static void ext4_apply_options(struct fs_context *fc, struct super_block *sb);
+static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param);
 
 /*
  * Lock ordering
@@ -121,6 +122,10 @@ static void ext4_apply_options(struct fs_context *fc, struct super_block *sb);
  * transaction start -> page lock(s) -> i_data_sem (rw)
  */
 
+static const struct fs_context_operations ext4_context_ops = {
+	.parse_param	= ext4_parse_param,
+};
+
 #if !defined(CONFIG_EXT2_FS) && !defined(CONFIG_EXT2_FS_MODULE) && defined(CONFIG_EXT4_USE_FOR_EXT2)
 static struct file_system_type ext2_fs_type = {
 	.owner		= THIS_MODULE,
@@ -1943,7 +1948,7 @@ EXT4_SET_CTX(mount_opt2);
 EXT4_SET_CTX(mount_flags);
 
 
-static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
+static int ext4_parse_param(struct fs_context *fc, struct fs_parameter *param)
 {
 	struct ext4_fs_context *ctx = fc->fs_private;
 	const struct mount_opts *m;
@@ -1977,19 +1982,19 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
 	case Opt_removed:
 		ext4_msg(NULL, KERN_WARNING, "Ignoring removed %s option",
 			 param->key);
-		return 1;
+		return 0;
 	case Opt_abort:
 		set_mount_flags(ctx, EXT4_MF_FS_ABORTED);
-		return 1;
+		return 0;
 	case Opt_i_version:
 		set_flags(ctx, SB_I_VERSION);
-		return 1;
+		return 0;
 	case Opt_lazytime:
 		set_flags(ctx, SB_LAZYTIME);
-		return 1;
+		return 0;
 	case Opt_nolazytime:
 		clear_flags(ctx, SB_LAZYTIME);
-		return 1;
+		return 0;
 	case Opt_errors:
 	case Opt_data:
 	case Opt_data_err:
@@ -2185,7 +2190,7 @@ static int handle_mount_opt(struct fs_context *fc, struct fs_parameter *param)
 		else
 			clear_mount_opt(ctx, m->mount_opt);
 	}
-	return 1;
+	return 0;
 }
 
 static int parse_options(struct fs_context *fc, char *options)
@@ -2223,7 +2228,7 @@ static int parse_options(struct fs_context *fc, char *options)
 			}
 		}
 
-		ret = handle_mount_opt(fc, &param);
+		ret = ext4_parse_param(fc, &param);
 		kfree(param.string);
 		if (ret < 0)
 			return ret;
-- 
2.21.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ