Message ID | 20240202155825.314567-2-masahiroy@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-50060-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp521729dyc; Fri, 2 Feb 2024 07:59:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtx5T/JdDdFRMUOhrdyepgUZdBOPFgOwBoT3fm850+y7BB63p4UHy7PJUHHaxecb1C5jXN X-Received: by 2002:a17:906:30d3:b0:a31:8944:2cf6 with SMTP id b19-20020a17090630d300b00a3189442cf6mr2051150ejb.8.1706889564654; Fri, 02 Feb 2024 07:59:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706889564; cv=pass; d=google.com; s=arc-20160816; b=AVmsTTp51Yh+IBDUV5JEF4zEhDRLavKBpmZuGd7yku/CrpQ/VSdSv0Ww77gxk5EAKV dp9uo9Ot0763woWLc8UI1e+dHAsy4FH/mFR5GINvT+gLZ90FYEcMSVHuYiqOtFzibw3H 1gpfxSmSwrdLvbPC4qMAUH97DxapVRA8F4/5Axrs0BFgoYA7dHyLM5fqkK0xg+oDKHv/ YdCICJspdR0XkrL6i2P+hyeEZNkrUPbQzjscgGWHFfVGb/ZQ7pwqRDZLY3Jt5+IVk6Jq Jwx7htWAkEOuKU76MqI2VG6GnWTLg0KpIdB9E360GJj8gYDSuRwX5ARiX5tDywNkzycg JR6Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=CxgzqSsqMZfSO2aGzVAqKWdHc1GS/5/rfQA5n2H97jo=; fh=YhI86J3KmZCgFtIbEBBODjgCKPxPkClZNMPl+n1b9Wc=; b=eomw8Vm8p1OBsQxqdC7DGdR5sfaIqvVQnDWE4PedG2KPDfn4yj3/tJkTulFvtHvORf jL6mdJoIDOtOC5yrCzqxHWOPpV2d/FnfCUnS6QsTLwhOmQon+SeWdITCw8dZVRzMuGt3 cBCY28LHW4y15gNYSRCTHeEN9Y00zDXUi7snDh32eF1HIXwZoSwqahRE8uh4D3go5LQ/ pDKOxFkKxJOGV1wChH9ZNp/hdDAlho5jkZ4A/Vrw9SMRlMnuNZmzI536CoZEDMG9VSAy h8tq/uSbAFtUJP+vGhG2q91uNCUL1KxKd6IxEYwoRIbfaMN3SUhxiMAql870dfTxvTgn 7QxQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NjPyEICc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50060-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50060-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXVyIAjMPRWW0S3iRpVABmVLiK0MFUENIcHk959L+3MXmTYQlfIyVrmXtESvPqnFhSYQQymHTqKDBq/b7qUk5wP2NYk8Q== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ca24-20020a170906a3d800b00a28ba5dd13asi821750ejb.1055.2024.02.02.07.59.24 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 07:59:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50060-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=NjPyEICc; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-50060-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50060-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 42F5C1F29D81 for <ouuuleilei@gmail.com>; Fri, 2 Feb 2024 15:59:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD8FD148317; Fri, 2 Feb 2024 15:58:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NjPyEICc" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BC991474D0; Fri, 2 Feb 2024 15:58:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706889512; cv=none; b=lBBQQp/omGHFvS6vgKdMn8qM5hm1zSBvU+dP4DeaSDztsAxhX4si5Ir4xK59dHHlSj+gb8LAnKiqKoWyo2xnStuIIOpL79H5hxupDEEVJQYoRJX+aCk8uq5YKUs/wYlWyFeWoQVYKA7w2VPecykrOsJPZaMjbnuLyiBA26uN744= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706889512; c=relaxed/simple; bh=0zjrnd8HxqGEk4V/+9L30lJo6lzcn61RhZYmqtdDahY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=rOEsJ0DYvyWGd+uuYSVzM6fM0Gu2IE252Uz8uITV2OizQ2IK0Cf+v3BLkSbu2DjJmL93LTv3j+9DYEM4C1cHpgQBxrwFa4r4VNn3TtATsD6ResTxD5mt/8rK68A9vUvtbjhoXHvIUg4U/tgXdi/r8u+D8Lu9lBgGsKREJx4aIwc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NjPyEICc; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0CBBC43390; Fri, 2 Feb 2024 15:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706889511; bh=0zjrnd8HxqGEk4V/+9L30lJo6lzcn61RhZYmqtdDahY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NjPyEICcCinl8z3u4AxSSHdlSJA2HhXiOK0v8gPVhLMPkDkG1KeD3HTgqSwUfxqfQ Icne3B9EFy9SqptamIRc+TR2Wf+s2AV7pRbWg/zPt4EqKzovuhH5B8AoENgdSQddfA c8Ka+yiJ0ellWjGRGL2fGQ+UtQwKC4r5b74KdkZHHp65cauwwa35qN42Aha/VsDx+2 EyYtH52Jnk8am2jFHpvfnt/ll1s4+ifKfEozdfMxNQ4z701wMKKqILKio1f7Ot+ovh /3JldDJD+nf8MJxG0eQjIeeZh2M4GEwB43qFbf0pR5ANvNH7U14vctxncRD3rInEbf j3DVnAR83Blag== From: Masahiro Yamada <masahiroy@kernel.org> To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada <masahiroy@kernel.org> Subject: [PATCH 01/27] kconfig: fix infinite loop when expanding a macro at the end of file Date: Sat, 3 Feb 2024 00:57:59 +0900 Message-Id: <20240202155825.314567-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240202155825.314567-1-masahiroy@kernel.org> References: <20240202155825.314567-1-masahiroy@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789803431769701547 X-GMAIL-MSGID: 1789803431769701547 |
Series |
kconfig: refactor lexer and parser code
|
|
Commit Message
Masahiro Yamada
Feb. 2, 2024, 3:57 p.m. UTC
A macro placed at the end of a file with no newline causes an infinite
loop.
[Test Kconfig]
$(info,hello)
\ No newline at end of file
I realized that flex-provided input() returns 0 instead of EOF when it
reaches the end of a file.
Fixes: 104daea149c4 ("kconfig: reference environment variables directly and remove 'option env='")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/lexer.l | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/scripts/kconfig/lexer.l b/scripts/kconfig/lexer.l index f93b535a080c..5f1bc3320307 100644 --- a/scripts/kconfig/lexer.l +++ b/scripts/kconfig/lexer.l @@ -303,8 +303,11 @@ static char *expand_token(const char *in, size_t n) new_string(); append_string(in, n); - /* get the whole line because we do not know the end of token. */ - while ((c = input()) != EOF) { + /* + * get the whole line because we do not know the end of token. + * input() returns 0 (not EOF!) when it reachs the end of file. + */ + while ((c = input()) != 0) { if (c == '\n') { unput(c); break;