Skip to contentSkip to conversation

kconfig: Warn if there is more than one help text

PATCH In review Ulf Magnusson 2 participants 2 messages Jan 12, 2018 – Jan 13, 2018

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

PATCH 1/1 kconfig: Warn if there is more than one help text

Avoids mistakes like in the following real-world example, where only the final help string ("Say Y...") was used. This particular example was fixed in commit 561b29e4ec8d ("media: fix media Kconfig help syntax issues").

config DVB_NETUP_UNIDVB
...
select DVB_CXD2841ER if MEDIA_SUBDRV_AUTOSELECT ---help---
Support for NetUP PCI express Universal DVB card.
help
Say Y when you want to support NetUP Dual Universal DVB card

        ...

This now prints the following warning:

drivers/media/pci/netup_unidvb:13: warning: 'DVB_NETUP_UNIDVB' defined with more than one help text -- only the last one will be used

Also free() any extra help strings.

---
 scripts/kconfig/zconf.y | 5 +++++
 1 file changed, 5 insertions(+)
scripts/kconfig/zconf.y +5 -0
index c1e4e82f56b5..06ef304ee325 100644
@@ -435,6 +435,11 @@ help_start: T_HELP T_EOL
 
 help: help_start T_HELPTEXT
 {
+	if (current_entry->help) {
+		free(current_entry->help);
+		zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used",
+			   current_entry->sym->name ?: "<choice>");
+	}
 	current_entry->help = $2;
 };
 
Signature · 1 line
2.14.1
#1 lore raw

2018-01-12 15:47 GMT+09:00 Ulf Magnusson <[email protected]>:

Quoted 14 lines

Avoids mistakes like in the following real-world example, where only the final help string ("Say Y...") was used. This particular example was fixed in commit 561b29e4ec8d ("media: fix media Kconfig help syntax issues").

config DVB_NETUP_UNIDVB
...
select DVB_CXD2841ER if MEDIA_SUBDRV_AUTOSELECT ---help---
Support for NetUP PCI express Universal DVB card.
help
Say Y when you want to support NetUP Dual Universal DVB card
...

Quoted 8 lines

This now prints the following warning:

drivers/media/pci/netup_unidvb:13: warning: 'DVB_NETUP_UNIDVB' defined with more than one help text -- only the last one will be used

Also free() any extra help strings.

---

Applied to linux-kbuild/kconfig
replacing "kconfig: Don't leak help strings during parsing"

Thanks!

Signature · 2 lines
Best Regards
Masahiro Yamada