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: <20230328122244.2521387-1-arnd@kernel.org>
Date:   Tue, 28 Mar 2023 14:22:31 +0200
From:   Arnd Bergmann <arnd@...nel.org>
To:     Jan Kara <jack@...e.com>, Yangtao Li <frank.li@...o.com>
Cc:     Arnd Bergmann <arnd@...db.de>,
        Christian Brauner <brauner@...nel.org>,
        Seth Forshee <sforshee@...italocean.com>,
        Dave Chinner <dchinner@...hat.com>,
        Roman Gushchin <roman.gushchin@...ux.dev>,
        Baokun Li <libaokun1@...wei.com>,
        "Matthew Wilcox (Oracle)" <willy@...radead.org>,
        Luis Chamberlain <mcgrof@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: [PATCH] fs: quota: avoid unused function warning for !CONFIG_SYSCTL

From: Arnd Bergmann <arnd@...db.de>

Having fs_dqstats_table[] inside of an #ifdef causes a build time
warning:

fs/quota/dquot.c:2864:12: error: 'do_proc_dqstats' defined but not used [-Werror=unused-function]
 2864 | static int do_proc_dqstats(struct ctl_table *table, int write,

Avoid this by using an IS_ENABLED() check in place of the #ifdef,
giving the compiler a better idea of how it is used.

Fixes: 63d00e08515b ("quota: check for register_sysctl() failure")
Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
Note: it may be better to just revert the 63d00e08515b patch, as the
additional pr_notice() does not seem to add much value after
the pr_err() printed by register_sysctl() that tells us exactly what
went wrong.
---
 fs/quota/dquot.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 05bed02b257f..6e9109c6218e 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -2877,7 +2877,6 @@ static int do_proc_dqstats(struct ctl_table *table, int write,
 	return proc_doulongvec_minmax(table, write, buffer, lenp, ppos);
 }
 
-#ifdef CONFIG_SYSCTL
 static struct ctl_table fs_dqstats_table[] = {
 	{
 		.procname	= "lookups",
@@ -2946,7 +2945,6 @@ static struct ctl_table fs_dqstats_table[] = {
 #endif
 	{ },
 };
-#endif
 
 static int __init dquot_init(void)
 {
@@ -2955,10 +2953,10 @@ static int __init dquot_init(void)
 
 	printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__);
 
-#ifdef CONFIG_SYSCTL
-	if (!register_sysctl("fs/quota", fs_dqstats_table))
-		pr_notice("quota sysctl registration failed!\n");
-#endif
+	if (IS_ENABLED(CONFIG_SYSCTL)) {
+		if (!register_sysctl("fs/quota", fs_dqstats_table))
+			pr_notice("quota sysctl registration failed!\n");
+	}
 
 	dquot_cachep = kmem_cache_create("dquot",
 			sizeof(struct dquot), sizeof(unsigned long) * 4,
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ