Commit a28d39c7 authored by Sergey Senozhatsky's avatar Sergey Senozhatsky Committed by Wentao Guan
Browse files

kconfig: WERROR unmet symbol dependency

stable inclusion
from stable-v6.6.76
commit 582e70f1eddfaa49c7ccbf4336166e9b6138ead0
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBW08Q

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=582e70f1eddfaa49c7ccbf4336166e9b6138ead0



--------------------------------

[ Upstream commit 15d3f7664d2776c086f813f1efbfe2ae20a85e89 ]

When KCONFIG_WERROR env variable is set treat unmet direct
symbol dependency as a terminal condition (error).

Suggested-by: default avatarStefan Reinauer <reinauer@google.com>
Signed-off-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Stable-dep-of: a409fc1463d6 ("kconfig: fix memory leak in sym_warn_unmet_dep()")
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
(cherry picked from commit 582e70f1eddfaa49c7ccbf4336166e9b6138ead0)
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
parent fb0fecf2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -827,6 +827,9 @@ int main(int ac, char **av)
		break;
	}

	if (conf_errors())
		exit(1);

	if (sync_kconfig) {
		name = getenv("KCONFIG_NOSILENTUPDATE");
		if (name && *name) {
@@ -890,6 +893,9 @@ int main(int ac, char **av)
		break;
	}

	if (sym_dep_errors())
		exit(1);

	if (input_mode == savedefconfig) {
		if (conf_write_defconfig(defconfig_file)) {
			fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n",
+8 −5
Original line number Diff line number Diff line
@@ -155,6 +155,13 @@ static void conf_message(const char *fmt, ...)
static const char *conf_filename;
static int conf_lineno, conf_warnings;

bool conf_errors(void)
{
	if (conf_warnings)
		return getenv("KCONFIG_WERROR");
	return false;
}

static void conf_warning(const char *fmt, ...)
{
	va_list ap;
@@ -349,10 +356,9 @@ int conf_read_simple(const char *name, int def)
	char *p, *p2, *val;
	struct symbol *sym;
	int i, def_flags;
	const char *warn_unknown, *werror, *sym_name;
	const char *warn_unknown, *sym_name;

	warn_unknown = getenv("KCONFIG_WARN_UNKNOWN_SYMBOLS");
	werror = getenv("KCONFIG_WERROR");
	if (name) {
		in = zconf_fopen(name);
	} else {
@@ -513,9 +519,6 @@ int conf_read_simple(const char *name, int def)
	free(line);
	fclose(in);

	if (conf_warnings && werror)
		exit(1);

	return 0;
}

+2 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ void conf_set_changed(bool val);
bool conf_get_changed(void);
void conf_set_changed_callback(void (*fn)(void));
void conf_set_message_callback(void (*fn)(const char *s));
bool conf_errors(void);

/* symbol.c */
extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];
@@ -22,6 +23,7 @@ void print_symbol_for_listconfig(struct symbol *sym);
struct symbol ** sym_re_search(const char *pattern);
const char * sym_type_name(enum symbol_type type);
void sym_calc_value(struct symbol *sym);
bool sym_dep_errors(void);
enum symbol_type sym_get_type(struct symbol *sym);
bool sym_tristate_within_range(struct symbol *sym,tristate tri);
bool sym_set_tristate_value(struct symbol *sym,tristate tri);
+9 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ static struct symbol symbol_empty = {

struct symbol *modules_sym;
static tristate modules_val;
static int sym_warnings;

enum symbol_type sym_get_type(struct symbol *sym)
{
@@ -320,6 +321,14 @@ static void sym_warn_unmet_dep(struct symbol *sym)
			       "  Selected by [m]:\n");

	fputs(str_get(&gs), stderr);
	sym_warnings++;
}

bool sym_dep_errors(void)
{
	if (sym_warnings)
		return getenv("KCONFIG_WERROR");
	return false;
}

void sym_calc_value(struct symbol *sym)