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-next>] [day] [month] [year] [list]
Message-ID: <123c391a-2569-6afd-2461-4e5b2ca298f3@kernel.dk>
Date:   Sun, 30 Apr 2023 10:54:38 -0600
From:   Jens Axboe <axboe@...nel.dk>
To:     Theodore Ts'o <tytso@....edu>
Cc:     "linux-ext4@...r.kernel.org" <linux-ext4@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: [PATCH] ext4: silence complaint if CONFIG_QUOTA isn't set

Compiling the kernel ext4 spews a warning that 'i' is unused in two
spots:

axboe@...ax ~/gi/linux-block (master)> make fs/ext4/super.o                    0.027s
  CALL    scripts/checksyscalls.sh
  CC      fs/ext4/super.o
fs/ext4/super.c: In function ?ext4_put_super?:
fs/ext4/super.c:1262:13: warning: unused variable ?i? [-Wunused-variable]
  1262 |         int i, err;
       |             ^
fs/ext4/super.c: In function ?__ext4_fill_super?:
fs/ext4/super.c:5200:22: warning: unused variable ?i? [-Wunused-variable]
  5200 |         unsigned int i;
       |                      ^

Put the quota freeing code into a helper so we can stub it out for
!CONFIG_QUOTA.

Signed-off-by: Jens Axboe <axboe@...nel.dk>
---

This appears new, but I didn't check what commit potentially broke
this...

 fs/ext4/super.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index d03bf0ecf505..5d85d7377d84 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1254,12 +1254,23 @@ static void ext4_flex_groups_free(struct ext4_sb_info *sbi)
 	rcu_read_unlock();
 }
 
+static void ext4_free_quotas(struct super_block *sb,
+			     struct ext4_sb_info *sbi)
+{
+#ifdef CONFIG_QUOTA
+	unsigned int i;
+
+	for (i = 0; i < EXT4_MAXQUOTAS; i++)
+		kfree(get_qf_name(sb, sbi, i));
+#endif
+}
+
 static void ext4_put_super(struct super_block *sb)
 {
 	struct ext4_sb_info *sbi = EXT4_SB(sb);
 	struct ext4_super_block *es = sbi->s_es;
 	int aborted = 0;
-	int i, err;
+	int err;
 
 	/*
 	 * Unregister sysfs before destroying jbd2 journal.
@@ -1310,10 +1321,7 @@ static void ext4_put_super(struct super_block *sb)
 	ext4_group_desc_free(sbi);
 	ext4_flex_groups_free(sbi);
 	ext4_percpu_param_destroy(sbi);
-#ifdef CONFIG_QUOTA
-	for (i = 0; i < EXT4_MAXQUOTAS; i++)
-		kfree(get_qf_name(sb, sbi, i));
-#endif
+	ext4_free_quotas(sb, sbi);
 
 	/* Debugging code just in case the in-memory inode orphan list
 	 * isn't empty.  The on-disk one can be non-empty if we've
@@ -5197,7 +5205,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
 	ext4_fsblk_t logical_sb_block;
 	struct inode *root;
 	int ret = -ENOMEM;
-	unsigned int i;
 	int needs_recovery;
 	int err = 0;
 	ext4_group_t first_not_zeroed;
@@ -5627,10 +5634,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
 	utf8_unload(sb->s_encoding);
 #endif
 
-#ifdef CONFIG_QUOTA
-	for (i = 0; i < EXT4_MAXQUOTAS; i++)
-		kfree(get_qf_name(sb, sbi, i));
-#endif
+	ext4_free_quotas(sb, sbi);
 	fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);
 	/* ext4_blkdev_remove() calls kill_bdev(), release bh before it. */
 	brelse(sbi->s_sbh);
-- 
2.39.2

-- 
Jens Axboe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ