Skip to contentSkip to conversation

sysctl: fix unused proc_cap_handler() function warning

PATCH In review Arnd Bergmann 4 participants 4 messages Jun 7, 2023 – Jun 29, 2023 Kernel usermode helper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sysctl: fix unused proc_cap_handler() function warning

From: Arnd Bergmann <[email protected]>

Since usermodehelper_table() is marked static now, we get a warning about it being unused when SYSCTL is disabled:

kernel/umh.c:497:12: error: 'proc_cap_handler' defined but not used [-Werror=unused-function]

Just move it inside of the same #ifdef.

Fixes e6944e3b75df7 ("sysctl: move umh sysctl registration to its own file")
---
 kernel/umh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/umh.c +1 -1
index d5dc3cc92d5c6..2f9249c2bf6ce 100644
@@ -494,6 +494,7 @@ int call_usermodehelper(const char *path, char **argv, char **envp, int wait)
 }
 EXPORT_SYMBOL(call_usermodehelper);
 
+#if defined(CONFIG_SYSCTL)
 static int proc_cap_handler(struct ctl_table *table, int write,
 			 void *buffer, size_t *lenp, loff_t *ppos)
 {
@@ -544,7 +545,6 @@ static int proc_cap_handler(struct ctl_table *table, int write,
 	return 0;
 }
 
-#if defined(CONFIG_SYSCTL)
 static struct ctl_table usermodehelper_table[] = {
 	{
 		.procname	= "bset",
Signature · 1 line
2.39.2
Acked-by Tested-by on v1 1/1
#1 lore raw
Quoted 11 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Since usermodehelper_table() is marked static now, we get a warning about it being unused when SYSCTL is disabled:

kernel/umh.c:497:12: error: 'proc_cap_handler' defined but not used [-Werror=unused-function]

Just move it inside of the same #ifdef.

Fixes e6944e3b75df7 ("sysctl: move umh sysctl registration to its own file")

Thanks.

Quoted 24 lines
---
 kernel/umh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/umh.c +1 -1
index d5dc3cc92d5c6..2f9249c2bf6ce 100644
@@ -494,6 +494,7 @@ int call_usermodehelper(const char *path, char **argv, char **envp, int wait)
 }
 EXPORT_SYMBOL(call_usermodehelper);
 
+#if defined(CONFIG_SYSCTL)
 static int proc_cap_handler(struct ctl_table *table, int write,
 			 void *buffer, size_t *lenp, loff_t *ppos)
 {
@@ -544,7 +545,6 @@ static int proc_cap_handler(struct ctl_table *table, int write,
 	return 0;
 }
 
-#if defined(CONFIG_SYSCTL)
 static struct ctl_table usermodehelper_table[] = {
 	{
 		.procname	= "bset",
Signature · 1 line
~Randy
Tested-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann

Hi Arnd,

Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Since usermodehelper_table() is marked static now, we get a warning about it being unused when SYSCTL is disabled:

kernel/umh.c:497:12: error: 'proc_cap_handler' defined but not used [-Werror=unused-function]

Thank you for the patch!

We also hit the same issue on our side after today's sync with Linus' tree. I confirm this patch fixes the issue.

I didn't see this patch applied in Luis' sysctl-next branch, do you know who is taking care of it?

Quoted 3 lines

Just move it inside of the same #ifdef.

Fixes e6944e3b75df7 ("sysctl: move umh sysctl registration to its own file")

A small detail: it looks like the SHA has been modified, it should be 861dc0b46432 instead of e6944e3b75df7:

Fixes 861dc0b46432 ("sysctl: move umh sysctl registration to its own file")

Cheers,
Matt

Signature · 2 lines
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net
maintainer
#3 lore raw
Quoted 12 lines · Matthieu Baerts

Hi Arnd,

Quoted 6 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

Since usermodehelper_table() is marked static now, we get a warning about it being unused when SYSCTL is disabled:

kernel/umh.c:497:12: error: 'proc_cap_handler' defined but not used [-Werror=unused-function]

Thank you for the patch!

Quoted 7 lines

We also hit the same issue on our side after today's sync with Linus' tree. I confirm this patch fixes the issue.

I didn't see this patch applied in Luis' sysctl-next branch, do you know who is taking care of it?

I'll send a second pull request to Linus now.

Quoted 8 lines
Quoted 3 lines

Just move it inside of the same #ifdef.

Fixes e6944e3b75df7 ("sysctl: move umh sysctl registration to its own file")

A small detail: it looks like the SHA has been modified, it should be 861dc0b46432 instead of e6944e3b75df7:

Fixes 861dc0b46432 ("sysctl: move umh sysctl registration to its own file")

Adjusted, thanks.

Luis