From 3e397ddacbaa61d766fde21ddbea30493c6df9b8 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Tue, 30 Jan 2024 23:37:11 +0100 Subject: [PATCH] util/kconfig: Uprev to Linux 6.7's kconfig Just a memory leak fix in Linux 6.7. Change-Id: I1ff302dafa01e78429a30ff18e21ffe0b45ce46e Signed-off-by: Patrick Georgi Reviewed-on: https://review.coreboot.org/c/coreboot/+/80263 Reviewed-by: Arthur Heymans Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber --- ...KCONFIG_STRICT-outside-of-confdata.c.patch | 22 +++++++++---------- ...nfig-Add-wildcard-support-for-source.patch | 8 +++---- util/kconfig/symbol.c | 14 +++++------- 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/util/kconfig/patches/0007-kconfig-Allow-KCONFIG_STRICT-outside-of-confdata.c.patch b/util/kconfig/patches/0007-kconfig-Allow-KCONFIG_STRICT-outside-of-confdata.c.patch index f98729e85b..a9f3218f35 100644 --- a/util/kconfig/patches/0007-kconfig-Allow-KCONFIG_STRICT-outside-of-confdata.c.patch +++ b/util/kconfig/patches/0007-kconfig-Allow-KCONFIG_STRICT-outside-of-confdata.c.patch @@ -26,43 +26,43 @@ Index: kconfig/symbol.c --- kconfig.orig/symbol.c +++ kconfig/symbol.c @@ -37,6 +37,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) { -@@ -319,12 +320,14 @@ static void sym_warn_unmet_dep(struct sy +@@ -317,12 +318,14 @@ static void sym_warn_unmet_dep(struct sy " Selected by [m]:\n"); - + fputs(str_get(&gs), stderr); + sym_warnings++; } - + void sym_calc_value(struct symbol *sym) { struct symbol_value newval, oldval; struct property *prop; + const char *werror; struct expr *e; - + if (!sym) -@@ -340,8 +343,9 @@ void sym_calc_value(struct symbol *sym) +@@ -338,8 +341,9 @@ void sym_calc_value(struct symbol *sym) sym_calc_value(prop_get_symbol(prop)); } - + + werror = getenv("KCONFIG_WERROR"); + sym_warnings = 0; sym->flags |= SYMBOL_VALID; - oldval = sym->curr; - + switch (sym->type) { -@@ -432,6 +436,9 @@ void sym_calc_value(struct symbol *sym) +@@ -430,6 +434,9 @@ void sym_calc_value(struct symbol *sym) ; } - + + if (sym_warnings && werror) + exit(1); + diff --git a/util/kconfig/patches/0008-kconfig-Add-wildcard-support-for-source.patch b/util/kconfig/patches/0008-kconfig-Add-wildcard-support-for-source.patch index b476bc1581..2e6a24f30f 100644 --- a/util/kconfig/patches/0008-kconfig-Add-wildcard-support-for-source.patch +++ b/util/kconfig/patches/0008-kconfig-Add-wildcard-support-for-source.patch @@ -28,7 +28,7 @@ Index: kconfig/lexer.l +++ kconfig/lexer.l @@ -8,6 +8,7 @@ %{ - + #include +#include #include @@ -37,7 +37,7 @@ Index: kconfig/lexer.l @@ -439,6 +440,32 @@ void zconf_nextfile(const char *name) current_file = file; } - + +void zconf_nextfiles(const char *wildcard) +{ + glob_t g; @@ -78,7 +78,7 @@ Index: kconfig/lkc.h +void zconf_nextfiles(const char *name); int zconf_lineno(void); const char *zconf_curname(void); - + Index: kconfig/parser.y =================================================================== --- kconfig.orig/parser.y @@ -91,4 +91,4 @@ Index: kconfig/parser.y + zconf_nextfiles($2); free($2); }; - + diff --git a/util/kconfig/symbol.c b/util/kconfig/symbol.c index a50f13121c..34fc66e075 100644 --- a/util/kconfig/symbol.c +++ b/util/kconfig/symbol.c @@ -123,9 +123,9 @@ static long long sym_get_range_val(struct symbol *sym, int base) static void sym_validate_range(struct symbol *sym) { struct property *prop; + struct symbol *range_sym; int base; long long val, val2; - char str[64]; switch (sym->type) { case S_INT: @@ -141,17 +141,15 @@ static void sym_validate_range(struct symbol *sym) if (!prop) return; val = strtoll(sym->curr.val, NULL, base); - val2 = sym_get_range_val(prop->expr->left.sym, base); + range_sym = prop->expr->left.sym; + val2 = sym_get_range_val(range_sym, base); if (val >= val2) { - val2 = sym_get_range_val(prop->expr->right.sym, base); + range_sym = prop->expr->right.sym; + val2 = sym_get_range_val(range_sym, base); if (val <= val2) return; } - if (sym->type == S_INT) - sprintf(str, "%lld", val2); - else - sprintf(str, "0x%llx", val2); - sym->curr.val = xstrdup(str); + sym->curr.val = range_sym->curr.val; } static void sym_set_changed(struct symbol *sym)