linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kconfig: Warn if there is more than one help text
@ 2018-01-12  6:47 Ulf Magnusson
  2018-01-13 13:18 ` Masahiro Yamada
  0 siblings, 1 reply; 2+ messages in thread
From: Ulf Magnusson @ 2018-01-12  6:47 UTC (permalink / raw)
  To: linux-kbuild; +Cc: yamada.masahiro, sam, linux-kernel, Ulf Magnusson

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.

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
---
 scripts/kconfig/zconf.y | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index c1e4e82f56b5..06ef304ee325 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -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;
 };
 
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kconfig: Warn if there is more than one help text
  2018-01-12  6:47 [PATCH] kconfig: Warn if there is more than one help text Ulf Magnusson
@ 2018-01-13 13:18 ` Masahiro Yamada
  0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2018-01-13 13:18 UTC (permalink / raw)
  To: Ulf Magnusson
  Cc: Linux Kbuild mailing list, Sam Ravnborg, Linux Kernel Mailing List

2018-01-12 15:47 GMT+09:00 Ulf Magnusson <ulfalizer@gmail.com>:
> 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.
>
> Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
> ---

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

Thanks!

-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-13 13:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-12  6:47 [PATCH] kconfig: Warn if there is more than one help text Ulf Magnusson
2018-01-13 13:18 ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).