Skip to contentSkip to conversation

proc/sysctl: make firmware loader table conditional

PATCH In review Arnd Bergmann 2 participants 3 messages Jun 17, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc/sysctl: make firmware loader table conditional

We get a link error in the firmware loader fallback table, which now refers to the global sysctl_vals variable:

drivers/base/firmware_loader/fallback_table.o:(.data+0x2c): undefined reference to sysctl_vals' drivers/base/firmware_loader/fallback_table.o:(.data+0x30): undefined reference to sysctl_vals' drivers/base/firmware_loader/fallback_table.o:(.data+0x50): undefined reference to sysctl_vals' drivers/base/firmware_loader/fallback_table.o:(.data+0x54): undefined reference to sysctl_vals'

Add an #ifdef that only builds that table when it is being used.

Fixes c81c506545f4 ("proc/sysctl: add shared variables for range check")
---
 drivers/base/firmware_loader/fallback_table.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/base/firmware_loader/fallback_table.c +2 -0
index 58d4a1263480..ba9d30b28edc 100644
@@ -23,6 +23,7 @@ struct firmware_fallback_config fw_fallback_config = {
 };
 EXPORT_SYMBOL_GPL(fw_fallback_config);
 
+#ifdef CONFIG_SYSCTL
 struct ctl_table firmware_config_table[] = {
 	{
 		.procname	= "force_sysfs_fallback",
@@ -45,3 +46,4 @@ struct ctl_table firmware_config_table[] = {
 	{ }
 };
 EXPORT_SYMBOL_GPL(firmware_config_table);
+#endif
Signature · 1 line
2.20.0
#1 lore raw
Quoted 36 lines · Arnd Bergmann

We get a link error in the firmware loader fallback table, which now refers to the global sysctl_vals variable:

drivers/base/firmware_loader/fallback_table.o:(.data+0x2c): undefined reference to sysctl_vals' drivers/base/firmware_loader/fallback_table.o:(.data+0x30): undefined reference to sysctl_vals' drivers/base/firmware_loader/fallback_table.o:(.data+0x50): undefined reference to sysctl_vals' drivers/base/firmware_loader/fallback_table.o:(.data+0x54): undefined reference to sysctl_vals'

Add an #ifdef that only builds that table when it is being used.

Fixes c81c506545f4 ("proc/sysctl: add shared variables for range check")
---
 drivers/base/firmware_loader/fallback_table.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/base/firmware_loader/fallback_table.c +2 -1
index 58d4a1263480..ba9d30b28edc 100644
@@ -23,6 +23,7 @@ struct firmware_fallback_config fw_fallback_config = {
 };
 EXPORT_SYMBOL_GPL(fw_fallback_config);
 
+#ifdef CONFIG_SYSCTL
 struct ctl_table firmware_config_table[] = {
        {
                .procname       = "force_sysfs_fallback",
@@ -45,3 +46,4 @@ struct ctl_table firmware_config_table[] = {
        { }
 };
 EXPORT_SYMBOL_GPL(firmware_config_table);
+#endif
--
Quoted 2 lines

2.20.0

Hi Arnd,

I think I've posted a similar patch before, I don't know if it's already in linux-next:

https://lore.kernel.org/linux-next/[email protected]/

Regards,

Signature · 2 lines
Matteo Croce
per aspera ad upstream
#2 lore raw
Quoted 26 lines · Matteo Croce
Quoted 21 lines
 drivers/base/firmware_loader/fallback_table.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/base/firmware_loader/fallback_table.c +2 -1
index 58d4a1263480..ba9d30b28edc 100644
@@ -23,6 +23,7 @@ struct firmware_fallback_config fw_fallback_config = {
 };
 EXPORT_SYMBOL_GPL(fw_fallback_config);
 
+#ifdef CONFIG_SYSCTL
 struct ctl_table firmware_config_table[] = {
        {
                .procname       = "force_sysfs_fallback",
@@ -45,3 +46,4 @@ struct ctl_table firmware_config_table[] = {
        { }
 };
 EXPORT_SYMBOL_GPL(firmware_config_table);
+#endif
--
Quoted 2 lines

2.20.0

Hi Arnd,

Quoted 5 lines

I think I've posted a similar patch before, I don't know if it's already in linux-next:

https://lore.kernel.org/linux-next/[email protected]/

Indeed, that is almost the same patch. Not sure what happened.

As Stephen replied to your patch, he had picked it up originally. Maybe it got lost in a rebase since then.

Arnd