From patchwork Thu May 17 06:16:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 136088 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1877318lji; Wed, 16 May 2018 23:19:13 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpAbkEdwQFlFVt4HJ4/XCHSvmLyn85fkynRKqvWma4IqJqF+Hgj/rPQURkHNKT6nCOeGgNN X-Received: by 2002:a17:902:8a8c:: with SMTP id p12-v6mr3883106plo.94.1526537953150; Wed, 16 May 2018 23:19:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526537953; cv=none; d=google.com; s=arc-20160816; b=FGsqS1KeqaPeE0e/d66h5ZPs/9QtKmP/zl0tCX4sY7W9f6mstTD5xPa3wSviYC6i1p bwxwAOMr3PQ1txoQVaFAGgP0O+iod/EoNs2mlJqcS5Bv4/srEc8IBebI4ilUXuoXNNJl N+TKFWSs70ofscjuw/gxEitJXyxsEAMMh2P66GNxL8jRtlc09lXbQ3ZO/4w4Fyo6u6bY kRspZN/WONnCKixfncUo/ClVu1FDAtbjNFvAJqPTNavSS9vGSVhGyXS1nqQ/biyQZZOG ngfmaeNljUIDRyug0lsat2r++IVjTncW+EKCR8Imlu3uuCDMlxOAmGOOhc23lrY/VXXc J1Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=I+o8yLfAxCl7jvK1vvUhdCXw/bHSIBQ/d1Sk8reh1yA=; b=gIPOiXPjrk8tatI4KarMDLXC0wAwNnyJwtMgENNFaxm5LlIxigWMvdRW6EV7f7YBSR W72i2hrwwZ/++Lwx7NgoX+vC8C3cctbg/V9m5VrPEUjo50AGNyMZ64xcnl4d2C+kgx50 Zp12IEi6PzAle3RXEu6PI7dPM0vmwcOHDsVW1JoHCdF6Ycz2GHfEzwcSWXGSv/KAaKtZ fyZlS5U41HAHTVc2LL1bv5tS04mQHU8FURIZlMZgzxMTJwMcvvh9OjsQhFI1IdS59y+k gcwQiScNkPu6I77LS3XPAjpNGe81qgd65vB9FyQ6241/ZPk3HwhykaDZ8PO8KWYPDuk5 G5qQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=DDv9Sh22; 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 f28-v6si4952932plj.255.2018.05.16.23.19.12; Wed, 16 May 2018 23:19:13 -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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=DDv9Sh22; 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 S1752141AbeEQGTK (ORCPT + 29 others); Thu, 17 May 2018 02:19:10 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:24362 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750825AbeEQGS4 (ORCPT ); Thu, 17 May 2018 02:18:56 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id w4H6HbU3002841; Thu, 17 May 2018 15:17:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com w4H6HbU3002841 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1526537863; bh=I+o8yLfAxCl7jvK1vvUhdCXw/bHSIBQ/d1Sk8reh1yA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DDv9Sh22vlARVGc8MP3HF8ozBpVH8/3vduR9Ri/fkF/VtkcV+hpG/ztQ1vUQ0jNTx Z115Ojg2g2DJOUInt2kU2o4pD6uwLRZhyQfAB/fpGgDw2AKjgcmEaZ59l3paOMAxEq /C6eLKTGODkrY91+srwkh7WXcpQa9rOBePioEHrBUe5csa2zY8SybAJgftQB/iRbZh ea8jRVehOXJriMJW9nhH3LUSborPMPqnzA61aRY1ysDE9zkBZCWvBy6whhzFmTUFHV 2jyu6sHORG2Br+gMHrDA+s/WTVSoknnmPI81k6glbdWZiMytoNe34xsjUwkOR6sK+k xLCiKR9k9Q0/w== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Linus Torvalds , Sam Ravnborg , Ulf Magnusson , "Luis R . Rodriguez" , linux-kernel@vger.kernel.org, Nicholas Piggin , Kees Cook , Emese Revfy , x86@kernel.org, Masahiro Yamada Subject: [PATCH v4 05/31] kconfig: remove string expansion for mainmenu after yyparse() Date: Thu, 17 May 2018 15:16:44 +0900 Message-Id: <1526537830-22606-6-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526537830-22606-1-git-send-email-yamada.masahiro@socionext.com> References: <1526537830-22606-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.7.4 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); + } menu_finalize(&rootmenu); for_all_symbols(i, sym) {