From patchwork Fri Apr 13 05:06:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 133323 Delivered-To: patch@linaro.org Received: by 10.46.84.18 with SMTP id i18csp345991ljb; Thu, 12 Apr 2018 22:11:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+abQryNXObMDb5+26ek5c639D9OEqtukI7EoL3W6MLVb0JMZ3gn1EpFciVBlhUZHMcmh3t X-Received: by 10.98.89.200 with SMTP id k69mr10270979pfj.100.1523596263976; Thu, 12 Apr 2018 22:11:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523596263; cv=none; d=google.com; s=arc-20160816; b=VAwAVwNJntgSrJ2yWrN8+VSCMoIsyUPNCQrskqDql5pnuJLWfWxG3PCGqqQdfpftBZ bBm+BhZyDydFtQwFu8INNj50mux4xvKiMxfssr4H6kuzAnju2nbO0r4Sjeqx3k61BMSx zRFqK8h3R1hztX200ZsOYv/+9NTjbJROUMlmSIWCjjF7c3pydKApBQP6OXeAX/4V3HE9 EI5hvDf5flqd1K6zvLujn2NnPkPxz42aczchYmw0Zsstmu4Im/zmjj7J8CuG8vry4lsr DSbU+FnbxzUmcPgz4iiyA2Fsho8oZtJ5/EG986gbzHqLgiiQm5H8mTAB7+qiyyo+pZQo mfNg== 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=ApQsRxhg+uQB31OxCSwqeIWF4lqBlzXYJC0ifRjW9TI=; b=cEQmbvSV48680woBIuoMRe21dr2wS2LZ4PY8HsGh4syw9Nf+V01HPVWeOzgcpfRZnb GxbBodVj3ZO7RLRhAMSkiYf06zIVEylg1jkv1Xh2Qr/GrL2yZBtG95Ui/6fFvNT7dcLv hT4ilUZhOEDTCSleBCmJO5fWFIcSRAphrVeB4EOXTeV/D0BAw7rr18vTlAtFANAQC+rd RKUARS/AHGAx5lGeCDl/K6y2HRmBC/2ysePY6hhFC1RG3oCiuZWb3WJ32YgPHmWF6/jZ oi+C2A7wvYJ5FYP/vihBU7CeJBbPv5qMA40rglwEK0dW2RIh5CK7AWdcH3VUG/zCzxei NMWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=wdKn9JDV; 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 d19-v6si4913546pls.334.2018.04.12.22.11.03; Thu, 12 Apr 2018 22:11:03 -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=wdKn9JDV; 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 S1752846AbeDMFIe (ORCPT + 29 others); Fri, 13 Apr 2018 01:08:34 -0400 Received: from conuserg-07.nifty.com ([210.131.2.74]:54957 "EHLO conuserg-07.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752223AbeDMFIa (ORCPT ); Fri, 13 Apr 2018 01:08:30 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-07.nifty.com with ESMTP id w3D56lg0029209; Fri, 13 Apr 2018 14:06:53 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-07.nifty.com w3D56lg0029209 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1523596013; bh=ApQsRxhg+uQB31OxCSwqeIWF4lqBlzXYJC0ifRjW9TI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wdKn9JDVOpy0nJHmltiHYZ0uj31Zwy0DtV37sS+NfXueYRKOUJwKlJUU92UWr8+v3 2Pyg2SViVelTGErYFLxj3/TPW4V3g08f5GVVqqu6DAXC9L/Z+cIf8P9TvSXNLdK0xN CugWupm7ywjcP5AXFgY6o2IdwmTuD5ozsowhcBFC2EFgy7epaSp1cICL6phtpWacrr 9d753X9KDjkm5Ksgg4E66VVi349mr6qhXUIVmj27fkL/6sb+hhauKbpg+Edkr8AL2t rs1RxaFI89/GvIPHa1DWPwROo66C7oBx5tDki1Hz1C9KN7VewG/LA43EnhqjVVEyWQ B+dynIz/h1qzA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Linus Torvalds , Sam Ravnborg , Ulf Magnusson , Nicholas Piggin , Kees Cook , Emese Revfy , x86@kernel.org, Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 06/30] kconfig: remove string expansion for mainmenu after yyparse() Date: Fri, 13 Apr 2018 14:06:15 +0900 Message-Id: <1523595999-27433-7-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523595999-27433-1-git-send-email-yamada.masahiro@socionext.com> References: <1523595999-27433-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 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) {