Skip to contentSkip to conversation

kconfig: fix MODULES-related bug in case of no .config

PATCH In review Ulf Magnusson 3 participants 4 messages Jul 27, 2010 – Jul 29, 2010

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

PATCH 1/1 kconfig: fix MODULES-related bug in case of no .config

Hi,

There seems to be a kconfig bug due to MODULES not always being evaluated if no .config is found. Take the following Kconfig as an example:

config MODULES
def_bool y

config FOO
def_tristate m

With no .config, the following configuration is generated:

CONFIG_MODULES=y
CONFIG_FOO=y

With an empty .config, the following:

CONFIG_MODULES=y
CONFIG_FOO=m

Tristate choice statements can also exhibit the problem, due to having an implicit rev_dep (select) containing "m".

The problem is that MODULES is never evaluted in conf_read_simple() unless there's a .config. The following patch fixes this.

scripts/kconfig/confdata.c +3 -1
diff -uNr linux.vanilla/scripts/kconfig/confdata.c linux.new/scripts/kconfig/confdata.c
@@ -170,8 +170,10 @@
 		if (in)
 			goto load;
 		sym_add_change_count(1);
-		if (!sym_defconfig_list)
+		if (!sym_defconfig_list) {
+			sym_calc_value(modules_sym);
 			return 1;
+		}
 
 		for_all_defaults(sym_defconfig_list, prop) {
 			if (expr_calc_value(prop->visible.expr) == no ||
#1 lore raw
Quoted 34 lines · Ulf Magnusson

Hi,

There seems to be a kconfig bug due to MODULES not always being evaluated if no .config is found. Take the following Kconfig as an example:

config MODULES
def_bool y

config FOO
def_tristate m

With no .config, the following configuration is generated:

CONFIG_MODULES=y
CONFIG_FOO=y

With an empty .config, the following:

CONFIG_MODULES=y
CONFIG_FOO=m

Tristate choice statements can also exhibit the problem, due to having an implicit rev_dep (select) containing "m".

The problem is that MODULES is never evaluted in conf_read_simple() unless there's a .config. The following patch fixes this.

diff -uNr linux.vanilla/scripts/kconfig/confdata.c linux.new/scripts/kconfig/confdata.c

scripts/kconfig/confdata.c +0 -0
@@ -170,8 +170,10 @@
 		if (in)

scripts/kconfig/confdata.c line 179

Quoted 10 lines
scripts/kconfig/confdata.c +3 -1
 			goto load;
 		sym_add_change_count(1);
-		if (!sym_defconfig_list)
+		if (!sym_defconfig_list) {
+			sym_calc_value(modules_sym);
 			return 1;
+		}
 
 		for_all_defaults(sym_defconfig_list, prop) {
 			if (expr_calc_value(prop->visible.expr) == no ||

Silly error in the patch. The correct patch follows.

scripts/kconfig/confdata.c +4 -1
diff -uNr linux.vanilla/scripts/kconfig/confdata.c linux.new/scripts/kconfig/confdata.c
@@ -170,8 +170,11 @@
 		if (in)
 			goto load;
 		sym_add_change_count(1);
-		if (!sym_defconfig_list)
+		if (!sym_defconfig_list) {
+			if (modules_sym)
+				sym_calc_value(modules_sym);
 			return 1;
+		}
 
 		for_all_defaults(sym_defconfig_list, prop) {
 			if (expr_calc_value(prop->visible.expr) == no ||
Reviewed-by
#2 lore raw
Quoted 27 lines · Ulf Magnusson
Quoted 26 lines · Ulf Magnusson

Hi,

There seems to be a kconfig bug due to MODULES not always being evaluated if no .config is found. Take the following Kconfig as an example:

config MODULES
def_bool y

config FOO
def_tristate m

With no .config, the following configuration is generated:

CONFIG_MODULES=y
CONFIG_FOO=y

With an empty .config, the following:

CONFIG_MODULES=y
CONFIG_FOO=m

Tristate choice statements can also exhibit the problem, due to having an implicit rev_dep (select) containing "m".

The problem is that MODULES is never evaluted in conf_read_simple() unless there's a .config. The following patch fixes this.

<snip>

Quoted 5 lines

Silly error in the patch. The correct patch follows.

Sounds good for me.

Quoted 21 lines

diff -uNr linux.vanilla/scripts/kconfig/confdata.c linux.new/scripts/kconfig/confdata.c

scripts/kconfig/confdata.c +4 -2
@@ -170,8 +170,11 @@
 		if (in)
 			goto load;
 		sym_add_change_count(1);
-		if (!sym_defconfig_list)
+		if (!sym_defconfig_list) {
+			if (modules_sym)
+				sym_calc_value(modules_sym);
 			return 1;
+		}
 
 		for_all_defaults(sym_defconfig_list, prop) {
 			if (expr_calc_value(prop->visible.expr) == no ||
--

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#3 lore raw
Quoted 26 lines · Américo Wang
Quoted 25 lines · Ulf Magnusson
Quoted 24 lines · Ulf Magnusson

Hi,

There seems to be a kconfig bug due to MODULES not always being evaluated if no .config is found. Take the following Kconfig as an example:

config MODULES
def_bool y

config FOO
def_tristate m

With no .config, the following configuration is generated:

CONFIG_MODULES=y
CONFIG_FOO=y

With an empty .config, the following:

CONFIG_MODULES=y
CONFIG_FOO=m

Tristate choice statements can also exhibit the problem, due to having an implicit rev_dep (select) containing "m".

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

The problem is that MODULES is never evaluted in conf_read_simple() unless there's a .config. The following patch fixes this.

<snip>

Quoted 2 lines

Silly error in the patch. The correct patch follows.

Even the previous patch was correct, sym_calc_value() does nothing if the argument is NULL.

Quoted 7 lines
Quoted 3 lines

Sounds good for me.

Thanks. Added for 2.6.36 to kbuild-2.6.git (this is not a .35 regression AFAICS).

Michal