lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 31 Jul 2011 00:13:45 +0100
From:	David Woodhouse <dwmw2@...radead.org>
To:	Arnaud Lacombe <lacombar@...il.com>
Cc:	"H. Peter Anvin" <hpa@...or.com>, linux-kernel@...r.kernel.org,
	linux-kbuild@...r.kernel.org
Subject: [PATCH 1/2] kconfig: Factor out conf_validate_choice_val() function
 from conf_read_simple()

We're going to want to do this from elsewhere, shortly...

Signed-off-by: David Woodhouse <David.Woodhouse@...el.com>
---
 scripts/kconfig/confdata.c |   42 +++++++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 2bafd9a..a518ab3 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -179,6 +179,27 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p)
 	return 0;
 }
 
+static void conf_validate_choice_val(struct symbol *sym, int def, int def_flags)
+{
+	struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
+	switch (sym->def[def].tri) {
+	case no:
+		break;
+	case mod:
+		if (cs->def[def].tri == yes) {
+			conf_warning("%s creates inconsistent choice state", sym->name);
+			cs->flags &= ~def_flags;
+		}
+		break;
+	case yes:
+		if (cs->def[def].tri != no)
+			conf_warning("override: %s changes choice state", sym->name);
+		cs->def[def].val = sym;
+		break;
+	}
+	cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
+}
+
 int conf_read_simple(const char *name, int def)
 {
 	FILE *in = NULL;
@@ -311,25 +332,8 @@ load:
 			continue;
 		}
 setsym:
-		if (sym && sym_is_choice_value(sym)) {
-			struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
-			switch (sym->def[def].tri) {
-			case no:
-				break;
-			case mod:
-				if (cs->def[def].tri == yes) {
-					conf_warning("%s creates inconsistent choice state", sym->name);
-					cs->flags &= ~def_flags;
-				}
-				break;
-			case yes:
-				if (cs->def[def].tri != no)
-					conf_warning("override: %s changes choice state", sym->name);
-				cs->def[def].val = sym;
-				break;
-			}
-			cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri);
-		}
+		if (sym && sym_is_choice_value(sym))
+			conf_validate_choice_val(sym, def, def_flags);
 	}
 	fclose(in);
 
-- 
1.7.6



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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ