Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2619668lqp; Mon, 25 Mar 2024 04:47:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWT+9Xz0aAT9UFJgF/N0w5LDWBejvjOZFZCWBNAkemgviNNicwLBN50Sh+8dde5O+v+zOPlv/3KHtimBXuKZCKMF7fvLcjcsBsCitWQaA== X-Google-Smtp-Source: AGHT+IHs7W8ttQ0mBVsO1Mwhkkem0FtmKfGBuqSEEt/jCbibOpBO8K18uSuBtb7qsFOgUuppY2DM X-Received: by 2002:a05:622a:1011:b0:431:469e:2231 with SMTP id d17-20020a05622a101100b00431469e2231mr7427949qte.27.1711367264695; Mon, 25 Mar 2024 04:47:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711367264; cv=pass; d=google.com; s=arc-20160816; b=WM+WETvNgda2FRwMseQdyrEskyGLXdOh9S5Oi8mMoRwNF8n3EtdxS6EHzM3p0bYpBX /Bi202PhEvjXFICSyAGDfQJSASm26Ruww5usaQTS8Ie57Fa28J5aZZqQNJfN/XWVLaJ+ ZIViYVRDvgaSkyGVRLi0YCvuZfc9TmAYP881rWUsO0U7lbU9j2RswcWxFknpqwoSRdMd 1/3p4H6IfbFtW665Dd6xEcYIrwjhCwamQoTJyOBgZMAreJ8HWIrnln2ONBfJdm9/398i z14aEn3t1zN4WZXgVLd1uOrpRdGEpe24tT4vPG9IsRqDwanmedt7j+POzBUhq22T9Lgu hUNQ== 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=7Jkmcf32HNYrqqTNn77VB5U0++d8vNXrcxKFqeH8gHU=; fh=qNZnFsddoXoStLuR43prh0sugzBZQRWUXBvfuohLwEU=; b=QNTksdBFTS6vKgI9B/2RgH4KVy3q6zxzCjtqAn5pr4eyrGHKEtwPjlyB1XwrnIyvqr c8N0dpcyP2rAXoReOARTEWfuea0u911fg7BSEVn0VSjGNmuq5rGGvj/HHwn/oJtpq3dX pcQIuu1kFGIA+dZ5Uf/5NgJShpXTMlvoVpPwRVqnzbHeSTqT9i9OEsKOPMRUrGmNzhTy 024Q0Hbc3eBANakLRnCiVzTJX5Xg9s/3WQk5hY30LXscYN65zS7xJzNEA7Hl4FUMznA7 QPQP0KoLBo+a5W/fWEZhKFnkyuxQahA7O+2ikO81+jJfywlwWBAHgrR+zlHA/SyrDxLs Dcgw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dv5QYpF6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116212-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f4-20020a05622a104400b004315f08b685si816616qte.131.2024.03.25.04.47.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 04:47:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-116212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dv5QYpF6; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-116212-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-116212-linux.lists.archive=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 361A91C34F10 for ; Mon, 25 Mar 2024 11:47:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD5073BEA3E; Mon, 25 Mar 2024 03:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dv5QYpF6" 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 93C1A17D247; Sun, 24 Mar 2024 23:43:54 +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=1711323834; cv=none; b=YdaPuwdVRNswhLQyRqnKA5ksxqFOSMFrkRNbZJnkrk+MCL+hiMOlWrS/Z0nPxmotvY1p4xc184g6TjwxQdqJ4KK2UVNbB43bUMl6MbVnzz3DtLwBxvii4y2LS+8t1f+4RccLrVzj7pQt8NiPAWAXEICIJf7TgP6bbBUw68nLhPk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711323834; c=relaxed/simple; bh=HsUg5S/3AqL4buyV0K0NxnhMGaC2KNaoIWRU8mW7eOA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sSiC4LqTjC4sDfBz5bA81HQjz/yRpgy2hwZgrusI6wGj9m5pe2TZMr35RFd0lr2BW7JTJl+b4DxgNdUTA2z7vIbkGaEw0dwwkxoo8FJ1cdl3eHZxJxjz4orGJemRXeUZezVasL6nWyONS5ISagOvOj4S/XmG+Wmqd1zhxywegmE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dv5QYpF6; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E91BEC433C7; Sun, 24 Mar 2024 23:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711323834; bh=HsUg5S/3AqL4buyV0K0NxnhMGaC2KNaoIWRU8mW7eOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dv5QYpF6LqdRqVUTpqYITd4jLS0G43jTz60d82SbgXKEJj8aA63vfA+vnLq2VsdSH oTtgS6RBVAa3LONJ7QKzYh4yirDplOw7RPQEZVHAPD+1IADgpm065lN6AbX0ukKB5V x+vEbDZw7R2M8yYCMbAnDzjrW4o6p1bphmrJ8snprLK8OMl9dfK7quCeVMt1JeNsDl tJ7+6m1IbKd7reUg3Bn2Dt5zDi8u5KdOIv1AneGv8TLTMBSGH5WEY4VEjgMVA+Qg+Z sMXcDLYDz3EN7WHJ7gtxXyWfRk9M68BQ58XGzpcyF0G88/eNyLVTlcYJMW8Zc2Eg+z vwQsBlIP2kaqw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Masahiro Yamada , Sasha Levin Subject: [PATCH 5.10 213/238] kconfig: fix infinite loop when expanding a macro at the end of file Date: Sun, 24 Mar 2024 19:40:01 -0400 Message-ID: <20240324234027.1354210-214-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324234027.1354210-1-sashal@kernel.org> References: <20240324234027.1354210-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Masahiro Yamada [ Upstream commit af8bbce92044dc58e4cc039ab94ee5d470a621f5 ] 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 Signed-off-by: Sasha Levin --- 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 240109f965aeb..72e5e9ac52bb4 100644 --- a/scripts/kconfig/lexer.l +++ b/scripts/kconfig/lexer.l @@ -305,8 +305,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; -- 2.43.0