Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp6645064imm; Sun, 20 May 2018 07:40:17 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrcKOypcHIFoIzicHKrBcx1SBLyK0cT+h4Ff2MnER+NlBiKMbMVsp0jmmW9RPOzRm7ah0WC X-Received: by 2002:a17:902:8bcb:: with SMTP id r11-v6mr17025659plo.51.1526827217552; Sun, 20 May 2018 07:40:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526827217; cv=none; d=google.com; s=arc-20160816; b=v1eS5Kshc7FFpif6eOvw2TmEuqQjO3wN3eV7oKjHJqi3T3ntgwaNALjSqlsviWuRxn PN0rIfb37mDi/PzLmHJ5kUTACS+nqnudB+vUG/KAbVae7ukwHK9ZXUbkRMrvqXfObVGg m57eoezIKgK37XGEfwOJI1g2a4+0KljifFUDiZtupMgW6i+t3habErt8sf2J7sijj8sS xEbfs7eNummnJfZlFDwKlhW4SKNgyMbvojS67grHbTzz+1TX9FfRO/JvU2SeSvTVlUgs 1fhrVF5djPSfV/RplVow9gcnLEtpiJK6beDmhuT6lvUp0XlPe4lluyjCYL9KDiIwIVyX b+KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=JIyyML+2/rDcTK9/vVR7jsUszn1CghFsrpbZS/DRPwc=; b=SQXcNrqdrVskvPTsgBUG1O6AB8UaG/2tIp0ZXFd8gEkN585SbQu/4JFZRV7gE7nXny qPsdH/QRvlggUhyhkxeLsqICtwcZO92KCwj/0E61hj6cpGMlstr3ostQIl1erX4OLVA8 6tlI/+qg5unuJT4Z+UM0X4m9+7+NdcQHqKq7FQcO6626pI4uC9hhSeIVkSkg/Wu5psRA D734zEroWOXq4MN4ToJV7FfKXw+RorBJP9/CrNMYizdQJC+1i+H/N34cuXGUxH3e59MK ywgF+qTARJr7qHOnlLMj56sgLyY7XZtyDioqsdcY8n8iqikR06/J5G0Y/ee6itWa/Vwi TvLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2-v6si13158276pli.569.2018.05.20.07.39.49; Sun, 20 May 2018 07:40:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751745AbeETOjj (ORCPT + 99 others); Sun, 20 May 2018 10:39:39 -0400 Received: from asavdk3.altibox.net ([109.247.116.14]:54019 "EHLO asavdk3.altibox.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751555AbeETOji (ORCPT ); Sun, 20 May 2018 10:39:38 -0400 Received: from ravnborg.org (unknown [158.248.196.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by asavdk3.altibox.net (Postfix) with ESMTPS id F402920031; Sun, 20 May 2018 16:39:34 +0200 (CEST) Date: Sun, 20 May 2018 16:39:33 +0200 From: Sam Ravnborg To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, Linus Torvalds , Ulf Magnusson , "Luis R . Rodriguez" , linux-kernel@vger.kernel.org, Nicholas Piggin , Kees Cook , Emese Revfy , x86@kernel.org Subject: Re: [PATCH v4 05/31] kconfig: remove string expansion for mainmenu after yyparse() Message-ID: <20180520143933.GA9826@ravnborg.org> References: <1526537830-22606-1-git-send-email-yamada.masahiro@socionext.com> <1526537830-22606-6-git-send-email-yamada.masahiro@socionext.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1526537830-22606-6-git-send-email-yamada.masahiro@socionext.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-CMAE-Score: 0 X-CMAE-Analysis: v=2.3 cv=dqr19Wo4 c=1 sm=1 tr=0 a=ddpE2eP9Sid01c7MzoqXPA==:117 a=ddpE2eP9Sid01c7MzoqXPA==:17 a=kj9zAlcOel0A:10 a=c-n4J4-pAAAA:8 a=cm27Pg_UAAAA:8 a=pGLkceISAAAA:8 a=CgTsw72b9cj2pn2SOOgA:9 a=CjuIK1q_8ugA:10 a=L0NDqeB7ZLmQzAogN4cw:22 a=xmb-EsYY8bH0VWELuYED:22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 17, 2018 at 03:16:44PM +0900, Masahiro Yamada wrote: > Now that environments are expanded in the lexer, conf_parse() does > not need to expand them explicitly. > > The hack introduced by commit 0724a7c32a54 ("kconfig: Don't leak > main menus during parsing") can go away. > > Signed-off-by: Masahiro Yamada > Reviewed-by: Kees Cook > Reviewed-by: Ulf Magnusson > --- > > Changes in v4: None > Changes in v3: None > Changes in v2: > - Simplify the patch. Just remove the text expansion. > > scripts/kconfig/zconf.y | 24 +++++------------------- > 1 file changed, 5 insertions(+), 19 deletions(-) > > diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y > index 3a4a0fa..22e318c 100644 > --- a/scripts/kconfig/zconf.y > +++ b/scripts/kconfig/zconf.y > @@ -109,7 +109,7 @@ static struct menu *current_menu, *current_entry; > %% > input: nl start | start; > > -start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list; > +start: mainmenu_stmt stmt_list | stmt_list; > > /* mainmenu entry */ > > @@ -118,19 +118,6 @@ mainmenu_stmt: T_MAINMENU prompt nl > menu_add_prompt(P_MENU, $2, NULL); > }; > > -/* Default main menu, if there's no mainmenu entry */ > - > -no_mainmenu_stmt: /* empty */ > -{ > - /* > - * Hack: Keep the main menu title on the heap so we can safely free it > - * later regardless of whether it comes from the 'prompt' in > - * mainmenu_stmt or here > - */ > - menu_add_prompt(P_MENU, xstrdup("Linux Kernel Configuration"), NULL); > -}; > - > - > stmt_list: > /* empty */ > | stmt_list common_stmt > @@ -528,7 +515,6 @@ word_opt: /* empty */ { $$ = NULL; } > > void conf_parse(const char *name) > { > - const char *tmp; > struct symbol *sym; > int i; > > @@ -544,10 +530,10 @@ void conf_parse(const char *name) > if (!modules_sym) > modules_sym = sym_find( "n" ); > > - tmp = rootmenu.prompt->text; > - rootmenu.prompt->text = _(rootmenu.prompt->text); > - rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); > - free((char*)tmp); > + if (!menu_has_prompt(&rootmenu)) { > + current_entry = &rootmenu; > + menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); Could this be something less specific? To help the other users of kconfig out is the wild. For example: menu_add_prompt(P_MENU, _("Main menu"), NULL); Note, the added _() to make the text translateable. Sam