[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230803164022.2232051-1-yoann.congal@smile.fr>
Date: Thu, 3 Aug 2023 18:40:22 +0200
From: Yoann Congal <yoann.congal@...le.fr>
To: Masahiro Yamada <masahiroy@...nel.org>,
linux-kbuild@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, Yoann Congal <yoann.congal@...le.fr>
Subject: [PATCH] kconfig: avoid an infinite loop in oldconfig/syncconfig
Exit on error when asking for value that has an invalid default value
and stdin is closed. Previously, this case would loop.
Signed-off-by: Yoann Congal <yoann.congal@...le.fr>
---
scripts/kconfig/conf.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 33d19e419908b..38ff9c81e071d 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -376,6 +376,15 @@ static int conf_string(struct menu *menu)
}
if (def && sym_set_string_value(sym, def))
return 0;
+ else {
+ if (feof(stdin) && !sym_string_valid(sym, sym_get_string_value(sym))) {
+ fprintf(stderr,
+ "Symbol %s has invalid default value and stdin reached EOF\n",
+ sym->name);
+ exit(1);
+ }
+ }
+
}
}
--
2.30.2
Powered by blists - more mailing lists