diff options
author | Kees Cook <keescook@chromium.org> | 2013-06-28 15:56:51 -0400 |
---|---|---|
committer | Yann E. MORIN <yann.morin.1998@free.fr> | 2013-06-29 09:30:17 -0400 |
commit | b57caaaed2bd127fe656e6c145970ed6a05c0125 (patch) | |
tree | 5c0e7308b579cc3bd94bac072d1b400274f8dc4b /scripts | |
parent | 490f16171119a16e05d670306c105f3b45c38837 (diff) |
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')
-rw-r--r-- | scripts/kconfig/symbol.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 387d55483882..d550300ec00c 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) | |||
136 | return NULL; | 136 | return NULL; |
137 | } | 137 | } |
138 | 138 | ||
139 | static int sym_get_range_val(struct symbol *sym, int base) | 139 | static long sym_get_range_val(struct symbol *sym, int base) |
140 | { | 140 | { |
141 | sym_calc_value(sym); | 141 | sym_calc_value(sym); |
142 | switch (sym->type) { | 142 | switch (sym->type) { |
@@ -155,7 +155,7 @@ static int sym_get_range_val(struct symbol *sym, int base) | |||
155 | static void sym_validate_range(struct symbol *sym) | 155 | static void sym_validate_range(struct symbol *sym) |
156 | { | 156 | { |
157 | struct property *prop; | 157 | struct property *prop; |
158 | int base, val, val2; | 158 | long base, val, val2; |
159 | char str[64]; | 159 | char str[64]; |
160 | 160 | ||
161 | switch (sym->type) { | 161 | switch (sym->type) { |
@@ -179,9 +179,9 @@ static void sym_validate_range(struct symbol *sym) | |||
179 | return; | 179 | return; |
180 | } | 180 | } |
181 | if (sym->type == S_INT) | 181 | if (sym->type == S_INT) |
182 | sprintf(str, "%d", val2); | 182 | sprintf(str, "%ld", val2); |
183 | else | 183 | else |
184 | sprintf(str, "0x%x", val2); | 184 | sprintf(str, "0x%lx", val2); |
185 | sym->curr.val = strdup(str); | 185 | sym->curr.val = strdup(str); |
186 | } | 186 | } |
187 | 187 | ||
@@ -594,7 +594,7 @@ bool sym_string_valid(struct symbol *sym, const char *str) | |||
594 | bool sym_string_within_range(struct symbol *sym, const char *str) | 594 | bool sym_string_within_range(struct symbol *sym, const char *str) |
595 | { | 595 | { |
596 | struct property *prop; | 596 | struct property *prop; |
597 | int val; | 597 | long val; |
598 | 598 | ||
599 | switch (sym->type) { | 599 | switch (sym->type) { |
600 | case S_STRING: | 600 | case S_STRING: |