summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/symbol.c
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2013-06-28 12:56:51 -0700
committerYann E. MORIN <yann.morin.1998@free.fr>2013-06-29 15:30:17 +0200
commitb57caaaed2bd127fe656e6c145970ed6a05c0125 (patch)
tree5c0e7308b579cc3bd94bac072d1b400274f8dc4b /scripts/kconfig/symbol.c
parent490f16171119a16e05d670306c105f3b45c38837 (diff)
downloadop-kernel-dev-b57caaaed2bd127fe656e6c145970ed6a05c0125.zip
op-kernel-dev-b57caaaed2bd127fe656e6c145970ed6a05c0125.tar.gz
kconfig: allow "hex" and "range" to support longs
The parsing routines for Kconfig files use strtol(), but store and render values as int. Switch types and formating to long to support a wider range of values. For example, 0x80000000 wasn't representable. Signed-off-by: Kees Cook <keescook@chromium.org> Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Diffstat (limited to 'scripts/kconfig/symbol.c')
-rw-r--r--scripts/kconfig/symbol.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 387d554..d550300 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -136,7 +136,7 @@ static struct property *sym_get_range_prop(struct symbol *sym)
return NULL;
}
-static int sym_get_range_val(struct symbol *sym, int base)
+static long sym_get_range_val(struct symbol *sym, int base)
{
sym_calc_value(sym);
switch (sym->type) {
@@ -155,7 +155,7 @@ static int sym_get_range_val(struct symbol *sym, int base)
static void sym_validate_range(struct symbol *sym)
{
struct property *prop;
- int base, val, val2;
+ long base, val, val2;
char str[64];
switch (sym->type) {
@@ -179,9 +179,9 @@ static void sym_validate_range(struct symbol *sym)
return;
}
if (sym->type == S_INT)
- sprintf(str, "%d", val2);
+ sprintf(str, "%ld", val2);
else
- sprintf(str, "0x%x", val2);
+ sprintf(str, "0x%lx", val2);
sym->curr.val = strdup(str);
}
@@ -594,7 +594,7 @@ bool sym_string_valid(struct symbol *sym, const char *str)
bool sym_string_within_range(struct symbol *sym, const char *str)
{
struct property *prop;
- int val;
+ long val;
switch (sym->type) {
case S_STRING:
OpenPOWER on IntegriCloud