Skip to content

Commit bfef491

Browse files
committed
kconfig: initialize sym->curr.tri to 'no' for all symbol types again
Geert Uytterhoeven reported that commit 4e244c1 ("kconfig: remove unneeded symbol_empty variable") changed the default value of CONFIG_LOG_CPU_MAX_BUF_SHIFT from 12 to 0. As it turned out, this is an undefined behavior because sym_calc_value() stopped setting the sym->curr.tri field for 'int', 'hex', and 'string' symbols. This commit restores the original behavior, where 'int', 'hex', 'string' symbols are interpreted as false if used in boolean contexts. CONFIG_LOG_CPU_MAX_BUF_SHIFT will default to 12 again, irrespective of CONFIG_BASE_SMALL. Presumably, this is not the intended behavior, as already reported [1], but this is another issue that should be addressed by a separate patch. [1]: https://lore.kernel.org/all/[email protected]/ Fixes: 4e244c1 ("kconfig: remove unneeded symbol_empty variable") Reported-by: Geert Uytterhoeven <[email protected]> Closes: https://lore.kernel.org/all/CAMuHMdWm6u1wX7efZQf=2XUAHascps76YQac6rdnQGhc8nop_Q@mail.gmail.com/ Tested-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]>
1 parent 358de8b commit bfef491

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

scripts/kconfig/symbol.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,8 @@ void sym_calc_value(struct symbol *sym)
345345

346346
oldval = sym->curr;
347347

348+
newval.tri = no;
349+
348350
switch (sym->type) {
349351
case S_INT:
350352
newval.val = "0";
@@ -357,7 +359,7 @@ void sym_calc_value(struct symbol *sym)
357359
break;
358360
case S_BOOLEAN:
359361
case S_TRISTATE:
360-
newval = symbol_no.curr;
362+
newval.val = "n";
361363
break;
362364
default:
363365
sym->curr.val = sym->name;

0 commit comments

Comments
 (0)